Forum Moderators: coopster
<label for="firstname"></label>
<input name="firstname" type="text" id="firstname" size="20" />
<br />
Last Name
<label for="lastname"></label>
<input name="lastname" type="text" id="lastname" size="20" />
<br />
Email<br />
<label for="email"></label>
<input name="email" type="text" id="email" size="20" />
</h2>
<h2>
<input type="submit" name="submit" id="submit" value="Download" />
</h2>
</form> <?php
$to ='myemailaddress@mysite.com';
$from = $_REQUEST['firstname'] ;
$name = $_REQUEST['lastname'] ;
$name = $_REQUEST['email'] ;
$headers = "From: $from";
$subject = "Article Download Subscriber";
$fields = array();
$fields{"firstname"} = "First Name";
$fields{"lastname"} = "Last Name";
$fields{"email"} = "Email Address";
$body = "This person just downloaded our e-article from the homepage:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: noreply@mysite.com";
$subject2 = "Thank you for downloading our e-article";
$autoreply = "Thank you for downloading our article. If for some reason you were not automatically directed to the location of the article, you can find the article by visiting this link: http://www.mysite.com/site/articledownload.html";
if($from == '') {print "You have not entered a first name, please go back and try again";}
else {
if($name == '') {print "You have not entered a field properly, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.mysite.com/site/articledownload.html" );}
else
{print "We encountered an error sending your mail, please notify user@mysite.com"; }
}
}
?>
Namely, I don't know what you mean about "there is no mail for $send2".
$send2 = mail($from, $subject2, $autoreply, $headers2);