Jump to content

405 error in PHP form


mina

Recommended Posts

I've searched almost every site on the internet and I cant seem to find a PHP form that actually works :S The ones I've tried keep ending up with a 405 Method Not Allowed error :)I dont know how any PHP so I dont know how to correct it.This is the code of the form I'm currently using-<form action="feedback.php" method="post"><table border="0" cellpadding="8" cellspacing="8" summary="feedback form"><tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr><tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr><tr><td colspan="2">Comments<br /><textarea rows="15" cols="45" name="comments"></textarea></td></tr><tr><td align="center" colspan="2"><input type="submit" value="Send Feedback" /><br /><a href="http://www.thesitewizard.com/">Powered by thesitewizard.com</a></td></tr></table></form>Link to the form- http://www.freewebs.com/gatecity2/cform.htmlAnd the php file- http://www.freewebs.com/gatecity2/feedback.phpI'm getting the 405 error on the form, if anyone can help me correct the error it would be very appreciated :)

Link to comment
Share on other sites

Is it a priority to sumbit your form via the post method? Do you know the difference between post and get (not tring to insult, I am just not sure of your level of php knowledge). Some php servers disable the post method for security reasons. Usually in that case the get method is still allowed. Let me know if you want more details on this option

Link to comment
Share on other sites

The post method submits your form info into the next page invisibly to the web user. The get method submits your form info to the next page using the url address. You have proabably seen many pages who's addresss looks like http://www.domain.com?variable=33&name=john&etc=otherstuffAll of the "?variable=33&name=john&etc=otherstuff" stuff on the end of those addresses are form information being passes along automatically by the get method of html forms.So to try this fix, just change the first line of your script to <form action="feedback.php" method="get">You will also have to check your page feedback.php. It may have lines retrieving the form info. Those commends look something like "$variable = $_POST['Comments'];". If that feedback.php page does contain these commands you need to change POST to GET. ($variable = $_GET['Comments'];Let me know if you have additional questions.

Link to comment
Share on other sites

Although I have run into this problem and solved it via using the get method verus the post method, I was wondering if anyone else knows how these methods are banned and/or how to change it. Are these settings that can be set in a .htaccesss file or anything like that.

Link to comment
Share on other sites

The post method submits your form info into the next page invisibly to the web user.  The get method submits your form info to the next page using the url address.  You have proabably seen many pages who's addresss looks like http://www.domain.com?variable=33&name=john&etc=otherstuffAll of the "?variable=33&name=john&etc=otherstuff" stuff on the end of those addresses are form information being passes along automatically by the get method of html forms.So to try this fix, just change the first line of your script to <form action="feedback.php" method="get">You will also have to check your page feedback.php.  It may have lines retrieving the form info.  Those commends look something like "$variable = $_POST['Comments'];".  If that feedback.php page does contain these commands you need to change POST to GET.  ($variable = $_GET['Comments'];Let me know if you have additional questions.

Now it sends me to my php page when I press 'Submit' :S Incase the php's been disabled is there any other type of form that submits when you press the button and doesn't ask you to sign in?
Link to comment
Share on other sites

The code you posted above does send your form information to a php page called feedback.php.Without more information I don't know what that page is suppose to do with the information. What is the purpose of this script. Are you sending the comments to a database, generating an email?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...