Jump to content


Photo

The requested method POST is not allowed


  • Please log in to reply
8 replies to this topic

#1 ryanT

ryanT
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 September 2006 - 01:32 PM

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

<html>
<head>
<title>submit form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php
if(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";
}
else
echo "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>


#2 Hepp

Hepp
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 18 September 2006 - 01:42 PM

This probably won't help, but it's worth a try.

Instead of:

<form method="post" action="submit.php">

Try:

<form action="submit.php" method="post">


#3 ryanT

ryanT
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 September 2006 - 01:45 PM

Same Result:

Method Not Allowed
The requested method POST is not allowed for the URL /parent/submit.php.

#4 Hepp

Hepp
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 18 September 2006 - 01:58 PM

The bottom of your coding isn't correct:

Change:

else
echo "not added";
{

To:

else
{
echo "not added";
}


#5 ryanT

ryanT
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 September 2006 - 02:02 PM

no difference, same error

Method Not Allowed
The requested method POST is not allowed for the URL /parent/submit.php.

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 September 2006 - 02:04 PM

echo "added";
}
else
echo "not added";
{
?>

... your form code ...
</body>
</html>
<?php
} // close the loop
?>

Legend has it that reading the manual never killed anyone.
My site

#7 ryanT

ryanT
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 18 September 2006 - 02:10 PM

Same error;

heres the page

http://www.scparent....anta/submit.php

#8 Hepp

Hepp
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 18 September 2006 - 02:19 PM

Try putting the connection to the database and whatnot in its own file, like config.php, and then include it in submit.php.

#9 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 18 September 2006 - 02:21 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users