Form method POST

schoolwork

Verified User
Joined
Mar 20, 2006
Messages
5
Location
Netherlands
Hi all,

I'm reasonably experienced with WEBdevelopment / programming... but totally new at hosting / server admin.

My question is about the SEND button on a HTML form. When I click it, I get the following message.

"Method Not Allowed
The requested method POST is not allowed for the URL /pages/main6.html"

where main6.html is the document where the button is placed.

Can anybody help?
 
Usually when I see this error reported it is caused by an attempt to 'post' variables to a html file, which often turns out to be the result of doing an assignment of _self to self.location or something similar in the action of the form.

But if you could post a link here to the webpage we can take a look at the code because you do not give much additional information to work with.
 
Hey Aspegic,

thanks for the reply!
The site is located at

http://readytoschool.nl/

The form is located in the bottom link in the menubar on the left (Aanmelden).

My problem occurs when pressing the button "verzenden", which is Dutch for "Send".

Thanks for the effort!
 
You have two forms on that page! I don't think you planned it hat way, maybe it's a leftover after you did some editing. Anyway, the form that contains the button has no 'action'. If you remove the </form> of the first form and delete the declaration of the second <form ...> (the one without an action) it should work.
 
Last edited:
Hi Aspegic,

that was it!
Thank you very much... I have no idea how that one got in...
I'll blame it on my not-so experienced co-admin ;)
I love it when a seemingly complex problem turns out to have a simple solution... thanks again for the effort!

Now on to getting the data in the mail formatted to a readable style...
 
PS. You can expect a lot of spam in your 'inschrijven' mailbox soon if you leave it like this. Nowadays spammers use crawlers that search websites for email addresses. If they find one that address will be added to their spamlists. Because your email address is visible in the html source code it will be found.
To prevent this you could write a php script that automatically sends the form data to a predefined email address without exposing the address itself in the source code.
 
Hi Aspegic you're a great help.

But you know when I said I'm experienced... I meant in HTML so PHP is a great unknown to me at this moment.

However I do know how to (OO) program so maybe changing an existing script to my situation is possible for me to do.

Do you know (a location for) a basic script to suit my need?

And are there any specific actions I must take to make it run?
 
If you don't have any experience with php maybe you could write a tiny bit of code in javascript that constructs the email address on-the-fly. Something similar to this:

var mail0 = "mailto:";
var mail1 = "inschrijven";
var mail2 = "readytoschool";
var mail3 = "nl";

mymail = mail0+mail1+"@"+mail2+"."+mail3+"?SUBJECT=aanmelding";

and then use the mymail variable to send the mail. This will make it more difficult for a crawler to figure out the complete email address. Of course if the crawler is really clever it could still figure it out but most crawlers aren't that smart.

As for a 'ready-made' script, there are zillions of them on the web. Just use google to search for them. You should find a few dozen in no time.
 
Last edited:
php mail form

'schoolwork'

You could also use this php mail script that was posted on the forum by Matrixx. It is easy to use, just edit the mail to address and link to your "Thankyou.html" page. On your form do something like:
Code:
<form name="form1" method="post" action="process.php">
See this post: I have used it a couple of times with no problems.
 
One word of caution if you do decide to take the php route.

An increasing source of spam nowadays is comming from mail forms that are being exploited.

Similar to the crawlers I mentioned above that scan for email addresses in html code, there are now also crawlers actively searching for websites that contain forms. When a form is found the crawler will fill in all fields with an email address and submit the form.

A spammer will monitor the mailbox of that email address. If an email arrives then the spammer will come to your form and will manually try to find out if it can be exploited.

Especially mail forms that include an option like "Email a copy of this message to myself" as a confirmation email are at risk.

I have setup a honeypot on my server specifically for attrackting attacks like this so I can find out what methods the spammers use to exploit the mail form. And I must say there are some pretty smart spammers out there!

The way to counter the attack is to check the input of the user for anything that shouldn't be there, filter out any special characters that may be entered in fields and especially watch out for the "@" character in fields where you would normally not expect them (and 'escape' any special characters in the output). Do not allow multiple email addresses to be entered in a field.

It is also a good idea to make this a 2-stage process where the first part accepts input from the user (the form) and sends this input to the second stage which does the actual checking of the input and sends the email if everything is ok. Do not use the command-line to send user input to the second script, instead use internal variables to make it harder for the spammer to pass illegal input. Also have the second script check the source of the request and only let it accept the request if it is comming from your own website (and not from some other source that duplicated the code of your first script on their own site).

Good luck with your form!
 
Last edited:
Image verification also helps. Although the more safe-guards you add the better chance of frusturating the genuine folks, unfortunately.
 
The matrixx php file appears good. The perl file I've got at our download page works as well, but it does require the email address be in your html. We resolve it using the method shown here.

Jeff
 
Hey everyone, thanks for all the help!

The last 2 days I have been visiting a forum (not online but an actual forum) so I haven't had time to reply, or try any suggestions.
I'll try to find some spare time this weekend...

greetings,
Schoolwork.
 
Back
Top