form to email php
Posted: Fri May 15, 2009 11:13 am
hello ~ need some help with form to email php script. my goal is to set up a 'refer this page to a friend' form. im having a tough time trouble-shooting because it doesn't seem to be working, and i am a bit of a noob...
here is the form code:
here is the php script:
any help is greatly appreciated!
here is the form code:
Code: Select all
<form method="post" action="email.php">
<font face="Verdana" size="1">(A link will be included in your email)</font>
<p><font face="Verdana" size="1">Your email:<br>
<input type="text" name="sender" size="20"></font></p>
<p><font face="Verdana" size="1">Recipient's email:<br>
<input type="text" name="recipient" size="20"></font></p>
<p><font face="Verdana" size="1">Message: (optional)<br>
</font><textarea rows="5" name="message" cols="28"></textarea><br>
<input type="submit" value="Send" style="width: 44; height: 23"></p>
</form>
Code: Select all
<?php
$to = $_POST['recipient'];
$subject = "market commentary";
$headers .= "Reply-To: " . $_POST['sender'] . "\r\n";
$headers .= "Return-Path: " . $_POST['sender'] . "\r\n";
$message = ("http://confidentiallink.net");
$message = $_POST['message'];
mail($to, $subject, $message, $headers);
// redirect back to url visitor came from
header("Location: thankyou.html");
?>