[Wolves] website forms

James Turner james at turnersoft.co.uk
Thu Sep 1 23:07:43 BST 2005


On Tuesday 30 Aug 2005 17:45, roundyz wrote:
> me and my mate have setup a halo 2 clan with a website.
> i have designed a form for potential clan members to join.
> How do I get the form to be emailed to a certain addy. As I don't have
> control over the server???
>
> do I just use this in the header?
>
> <form action="mailto:whereeve at wherever.com" action="post">

Nope... It is not possible to mail the data directly from the form, only to 
pass it via a HTTP request to a script/program that will then do the mailing 
for you. Perl, PHP, Python, etc, are all suitable for implementing such a 
script.

The <form> element's "action" attribute specifies the URI of the script that 
will receive the form data. From the W3C spec: "User agent behavior for a 
value other than an HTTP URI is undefined.". The "method" attribute allows 
you to select between two ways of passing the form data to the script. The 
"POST" method will pass the data in the HTTP request header while the "GET" 
method will pass it in the URL.

References: http://www.w3.org/TR/html4/interact/forms.html


Here's a quick PHP example of how you would retrieve the form data and mail it 
off. Use $_POST[] instead of $_GET[] if you are using the "POST" form method

$grovel_message = $_GET["grovel_message"];
mail("billg at microsoft.com","I'm your biggest fan",$grovel_message);

References: http://www.php.net/manual/en/function.mail.php


Hope this helps,

James



More information about the Wolves mailing list