View Full Version : Help with simple form please...

08-19-2009, 12:46 AM

I have been able to make a simple contact form work in the past... but now I'm trying to do the following:

The form contains name, email and telephone. I'd like it to send from the form email but contain all three of those in the message body.


<form name="form1" method="post" action="sendmail.php">
<label><span class="style13">Register As My Guest: </span><span class="style14"><br>
Name: </span> <br>
<input type="textfield" name="name">
<label><span class="style14">Email: <br>
<input type="textfield" name="email">
<label class="style14">Telephone: <br>
<input type="textfield" name="telephone">
<input name="Submit2" type="submit" class="style14" value="Submit">


$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$telephone = $_REQUEST['telephone'] ;

mail( "info@mysite.net", "New Guest Registration!",
$name, $email, $telephone, "From: $email" );
header( "Location: http://www.mysite.net/thankyouregistered.html" );

Any help is greatly appreciated :)

08-19-2009, 12:52 AM
$name = $_REQUEST['name']
should be
$name = $_POST['name'] as the form is sending post values

08-20-2009, 05:34 PM
That did not appear to work... it sends fine with "REQUEST" I just can't get it to send all the parts in the message area. I'd like it to send an email as follows:

from: $email

Message body:


08-21-2009, 01:17 AM
ok but i cant see why you would use it . $_REQUEST

08-21-2009, 01:21 AM
Because it works and using "POST" does not. It doesn't do anything with I change it to POST...

08-21-2009, 01:40 AM
ok but i dont see any benefit from using request as it is used to collect $_POST and $_GET values, and can , i believe give problems as it collects cookies and could give security assues. howeve no matter. try this ( i change to POST but use what you want)

$name = $_POST['name'] ;
$email = $_POST['email'] ;
$telephone = $_POST['telephone'] ;
$subject="New Guest Registration!";
$message="From: $email \n
name : $name \n
Telephone : $telephone
" ;

$email, $telephone,
mail( $mail,$subject,$message);
header( "Location: http://www.mysite.net/thankyouregistered.html" );