john_in_Parrish Posted December 5, 2013 Share Posted December 5, 2013 Hi everyone, I am very green to php and I am trying to create code that will allow me to enter information to a database I constructed. Everytime I run it though I get an object not found error 404. I have searched google and have found some information however I am unable to correct my error, Any help would be greatly appreciated. John, Here is ithe code <html> <head> </head> <body> <form action = 'insertform.php' method='post'> Maker:<input type="text" name="maker"><br /><br /> Contact:<input type="text" name="contact"><br /><br /> Location:<input type="text" name="location"><br /><br /> Phone:<input type="int" name="phone"><br /><br /> <input type="submit" name="submit"> </form> </body> </html> <?php if (isset($_POST['submit'])){ $con = mysql_connect("localhost","root",""); if(!$con){ die("Cannot Connect: " . mysql_error()); } mysql_select_db("ListParts2",$con); $sql = "INSERT INTO Manufacturer (Maker,Contact,Location,Phone) VALUES ('$_POST[maker]','$_POST[contact]','$_POST[location]','$_POST[phone]')"; mysql_query($sql,$con); mysql_close($con); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/284559-help-with-this-code-please/ Share on other sites More sharing options...
Ch0cu3r Posted December 5, 2013 Share Posted December 5, 2013 Everytime I run it though I get an object not found error 404. That error is coming from your web server. 404 errors usually means you have requested for a file but the server couldn't find it. When the form is submitted the file that is requested is called insertform.php. Do you have this file spelled correctly? and is it in the same path as the html form? Quote Link to comment https://forums.phpfreaks.com/topic/284559-help-with-this-code-please/#findComment-1461387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.