Using mail() to redirect user information
//File: index.php
<html>
<head>
<title></title>
</head>
<body>
<?
$form = "
<form action=\"index.php\" method=\"post\">
<input type=\"hidden\" name=\"seenform\" value=\"y\">
<b>Send us your comments!</b><br>
Your Name:<br>
<input type=\"text\" name=\"name\" value=\"\"><br>
Your Email:<br>
<input type=\"text\" name=\"email\" value=\"\"><br>
Your Comments:<br>
<textarea name=\"comments\"></textarea><br>
<input type=\"submit\" value=\"submit!\">
</form>
";
if ($seenform != "y") :
print "$form";
else :
$recipient = "y@youremail.com";
$subject = "User Comments ($name)";
$headers = "From: $email";
mail($recipient, $subject, $comments, $headers) or die("Could not send email!");
print "Thank you $name for taking a moment to send us your comments!";
endif;
?>
</body>
</html>
Related examples in the same category