I'm trying to make a very simple e-mail form for my website. The variables I want to collect are: Name, E-Mail, Website and Message. So far I have email and message... I'm having problems adding name and website in there... can someone help me out.
This is the code I have right now for my form:
<form action="http://storyboutagirl.org/contact.php" method="post">
E-mail:<br /><input name="email" size="20" type="text" /><p />
Message:<br /><textarea cols="20" rows="5" name="message"></textarea>
<br />
<input name="submit" type="submit" value="submit" />
</form>
But this is what I actually want:
<form action="http://storyboutagirl.org/contact.php" method="post">
Name:<br /><input name="name" size="20" type="text" /><p />
E-mail:<br /><input name="email" size="20" type="text" /><p />
Website: <input name="website" size="20" type="text" /><p />
Message:<br /><textarea cols="20" rows="5" name="message"></textarea>
<br />
<input name="submit" type="submit" value="submit" />
</form>
This is what I have in contact.php:
<?php
$to = "storyboutagirl@gmail.com";
$subject = "Feedback Form";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers, $email) ;
if($sent)
{print "Your mail was sent successfully. Hit the back button to go back till I figure out how to redirect"; }
else
{print "We encountered an error sending your mail"; }
?>
My question is how do I add the name and website variables into that code so it prints in the email and tells me the name, email address, and website of the person sending me the e-mail as well as the message?
Any help would be greatly appreciated! Thanks!