We need to have the users email address from the form they filled out on our site to be the "reply to" address once i receive the data to my inbox.
we would like to set our auto-responder to automatically send a message to that user and not to the data receiving email
here is the php we need to adjust Please help us learn by showing us the secrete code that makes the magic happen.
Thanking you in advance for your efforts to help us
PHP FORM TO MAIL:
<?php
$subject = 'Request For Golf Brochure - User Contact Info';
$emailadd = 'emil@mediababy.net';
$url = '/';
$req = '1';
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FormToEmail.php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<div>
<center>
<p><b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
<br>
<br>
Your information was received. Shortly, we will send you an email confirming your request<span style="text-align: center">.</span><br>
<br>
<img src="NEB_thankyou.jpg" width="550" height="200"></p>
<p><input type="button" value="Close Window" onClick="window.close()">
<br>
</p>
</center>
</div>
</body>
</html>
</body>
</html>
FORM:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nebraska-ContactForm</title>
<style type="text/css">
#ContactForm p span {
font-size: 14px;
}
body {
text-align: justify;
}
</style>
<script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<script type="text/javascript">
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
</script>
<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="ContactForm" name="ContactForm" method="post" action="FormToMail.php">
<p><img src="NEB_pi_03111_580x350edit.jpg" width="580" height="312" alt="" /><br />
<br />
Nebraska offers an endless string of outstanding golf opportunities. The brochure is Nebraska's <br />
latest tool for planning your next getaway, plus you will receive our monthly e-newsletters. <br />
<label><script type="text/javascript">
var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1");
var sprycheckbox2 = new Spry.Widget.ValidationCheckbox("sprycheckbox2");
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1");
</script> <br style="text-decoration: underline;" />
Please fill out your contact information and click "Submit" at the bottom of this page.<br />
<br />
First Name<br />
<input name="firstname" type="text" id="firstname" />
</label>
<br />
<label>Last Name<br />
<input name="lastname" type="text" id="lastname" />
</label>
<br />
<label>Street Address<br />
<input name="street address" type="text" id="street address" />
</label>
<br />
<label>City<br />
<input name="city" type="text" id="city" />
</label>
<br />
<label for="state">State</label>
<br />
<select name="state2" id="state">
<option>AL</option>
<option>AK</option>
<option>AZ</option>
<option>AR</option>
<option>CA</option>
<option>CO</option>
<option>CT</option>
<option>DE</option>
<option>FL</option>
<option>GA</option>
<option>HI</option>
<option>ID</option>
<option>IL</option>
<option>IN</option>
<option>IA</option>
<option>KS</option>
<option>KY</option>
<option>LA</option>
<option>ME</option>
<option>MD</option>
<option>MA</option>
<option>MI</option>
<option>MN</option>
<option>MS</option>
<option>MO</option>
<option>MT</option>
<option>NE</option>
<option>NV</option>
<option>NH</option>
<option>NJ</option>
<option>NM</option>
<option>NY</option>
<option>NC</option>
<option>ND</option>
<option>OH</option>
<option>OK</option>
<option>OR</option>
<option>PA</option>
<option>RI</option>
<option>SC</option>
<option>SD</option>
<option>TN</option>
<option>TX</option>
<option>UT</option>
<option>VT</option>
<option>VA</option>
<option>WA</option>
<option>WV</option>
<option>WI</option>
<option>WY</option>
</select>
<label> </label>
<label><br />
Zip Code<br />
<input name="zipcode" type="text" id="zipcode" />
<br />
</label>
Email Address<br />
<input name="emailaddress" type="text" id="emailaddress" />
<br />
Please send me your golf brochure via:<br />
<span id="spryradio2">
<label>
<input type="radio" name="Delivery Method" value="USPS" id="RadioGroup1_0" />
USPS</label>
<br />
<label>
<input type="radio" name="Delivery Method" value="email" id="RadioGroup1_1" />
email
</label>
<br />
<span class="radioRequiredMsg">Please select type mail delivery.</span></span><br />
<input type="submit" onclick="MM_validateForm('radio','','R','firstname','','R','lastname','','R','street address','','R','city','','R','zipcode','','R','email address','','R');return document.MM_returnValue" value="Submit" />
</form>
<script type="text/javascript">
var spryradio2 = new Spry.Widget.ValidationRadio("spryradio2");
</script>
</body>
</html>


Sign In
Create Account


Back to top









