July 15, 201313 yr Ok guys please help, all the other boxes post to the database except $proddesc: saveproduct.php <?php include("db.php"); $servicecentre=$_POST['servicecentre']; $ponumber=$_POST['ponumber']; $prodcode=$_POST['productcode']; $proddesc=$_POST['productdescription']; $price=$_POST['price']; $qty=$_POST['quantity']; $total=$_POST['total']; mysql_query("INSERT INTO purchaseorder (servicecentre,ponumber,productcode,productdescription,price,quantity,total) VALUES ('$servicecentre','$ponumber','$prodcode','$proddesc','$price','$qty','$total')"); header("location: tableedit.php#page=addpro"); ?> and the HTML: <div class="content" id="addpro"> <form style="text-align:right"action="saveproduct.php" method="post"> <div style="width:400px; text-align:right"> <div style="margin-left: 48px;"> Service Centre: <input name="servicecentre" type="text" /> </div> <br /> <div style="margin-left: 97px;"> PO Number: <input name="ponumber" type="text" /> </div> <br /> <div style="margin-left: 80px;"> Product Code: <input name="productcode" type="text" /> </div> <br /> <div style="margin-left: 80px;"> Product Description: <input name="proddesc" type="text" /> </div> <br /> <div style="margin-left: 80px;"> Price: £<input name="price" type="text" /> </div> <br /> <div style="margin-left: 80px;"> Quantity: <input name="quantity" type="text" /> </div> <br /> <div style="margin-left: 80px;"> Total: £<input name="total" type="text" /> </div> <div style="margin-left: 127px; margin-top: 14px;"><input name="" type="submit" value="Add" /></div> </div> </form> </div> Thanks In advanced
July 15, 201313 yr $proddesc=$_POST['productdescription']; to $proddesc=$_POST['proddesc']; the names in the input didnt match! Edited July 15, 201313 yr by inlinedivblock
July 15, 201313 yr Author $proddesc=$_POST['productdescription']; to $proddesc=$_POST['proddesc']; the names in the inpute didnt match! Thank you so much for your quick reply it was driving me nuts, the only thing i have to ask is i thought where $_POST['proddesc] is i thought had to be the database column that i wanted to post to, sorry but im new to php, HTML and CSS is my specialty
July 15, 201313 yr haha no worries, i wasn't going to make big DEAL out of it, as i do it all the time...You might want to think about securing the results, as the way it is coded it is open to hacking, someone can actually extract all your data the way you have it.Have a look a little read of this http://php.net/manual/en/function.mysql-real-escape-string.php or lookup SQL Injection in google. Edited July 15, 201313 yr by inlinedivblock
Create an account or sign in to comment