ryanT Posted September 18, 2006 Share Posted September 18, 2006 Im getting this error while simply trying to post to a DataBase...The requested method POST is not allowed for the URL /parent/insert.php.I can't figure out why.. please help[code]<html><head><title>submit form</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><?phpif(isset($_POST['add'])){$username="XXXXXr";$password="XXXXX";$database="XXXXX";$pfirst=$_POST['parentfirst'];$plast=$_POST['parentlast'];$pphone=$_POST['parentphone'];$pemail=$_POST['parentemail'];$kfirst=$_POST['kidfirst'];$kemail=$_POST['kidemail'];$wish=$_POST['kidwishlist'];$pi=$_POST['parentinitals'];mysql_connect("XXX.XXXXX.XXX",$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query = "INSERT INTO contacts VALUES ('','$pfirst','$plast','$pphone','$pemail','$kfirst','$kemail','$wish','$pi')";mysql_query($query);mysql_close();echo "added";}elseecho "not added";{?><form method="post" action="submit.php">Parent First Name: <input type="text" name="parentfirst"><br>Parent Last Name: <input type="text" name="parentlast"><br>Parent Phone: <input type="text" name="parentlast"><br>Parent Email: <input type="text" name="parentemail"><br>Kid First Name: <input type="text" name="kidfirst"><br>Kid E-mail: <input type="text" name="kidemail"><br>Kid Wish List: <input type="text" name="kidwishlist"><br>Parent Initals: <input type="text" name="parentinitals"><br><input name="add" type="submit" id="add" value="Submit"></form></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Hepp Posted September 18, 2006 Share Posted September 18, 2006 This probably won't help, but it's worth a try.Instead of:[code]<form method="post" action="submit.php">[/code]Try:[code]<form action="submit.php" method="post">[/code] Quote Link to comment Share on other sites More sharing options...
ryanT Posted September 18, 2006 Author Share Posted September 18, 2006 Same Result:Method Not AllowedThe requested method POST is not allowed for the URL /parent/submit.php. Quote Link to comment Share on other sites More sharing options...
Hepp Posted September 18, 2006 Share Posted September 18, 2006 The bottom of your coding isn't correct:Change:[code]elseecho "not added";{[/code]To:[code]else{echo "not added";}[/code] Quote Link to comment Share on other sites More sharing options...
ryanT Posted September 18, 2006 Author Share Posted September 18, 2006 no difference, same errorMethod Not AllowedThe requested method POST is not allowed for the URL /parent/submit.php. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 18, 2006 Share Posted September 18, 2006 [code]echo "added";}elseecho "not added";{?>... your form code ...</body></html><?php} // close the loop?>[/code] Quote Link to comment Share on other sites More sharing options...
ryanT Posted September 18, 2006 Author Share Posted September 18, 2006 Same error;heres the pagehttp://www.scparent.com/santa/submit.php Quote Link to comment Share on other sites More sharing options...
Hepp Posted September 18, 2006 Share Posted September 18, 2006 Try putting the connection to the database and whatnot in its own file, like config.php, and then include it in submit.php. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 18, 2006 Share Posted September 18, 2006 Looks like your host has doesn't allow POST requests. You might want to talk to your host about this. Your code is fine. It is a server configuration issue on your hosts part. Quote Link to comment 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.