Why does my form take every entry and pass them to the php apart from the last one? -
i using following form try , take data update database.
<form id="dataform" action="addtoproducts.php" method="post"> <div> <lable >product name:</lable> <input class="inputform" id="addname" type="text" name="name"> </div> <div> <lable>description:</lable> <input class="inputform" id="adddescription" type="text" name="description"> </div> <div> <lable>price:</lable> <input class="inputform" id="addprice" type="text" name="price"> </div> <div> <lable>quantity:</lable> <input class="inputform" id="addquantity" type"text" name"quantity"> </div> <div id="thesubmit"> <button id="addbutton">submit</button> </div> </form>
i using following php code update database. when run following code clicking submit passes values database apart quantity , leaves @ 0 , can not work out why after several hours of looking @ it. here php code..
$name = $_post['name']; $description = $_post['description']; $price = $_post['price']; $quantity = $_post['quantity']; $sql = "insert products (p_name, p_description, p_price, p_quantity) values ('$name', '$description', '$price', '$quantity') "; $conn->exec($sql);
any pointers great help
you have missed '=' here
<lable>quantity:</lable> <input class="inputform" id="addquantity" type"text" name"quantity">
changed
<lable>quantity:</lable> <input class="inputform" id="addquantity" type="text" name="quantity">
Comments
Post a Comment