I have been playing with this non-stop for hours and I can;t get it to put the from: Email Address in the from:subject line in my email. Can anyone tell me what I'm doing wrong here. I would greatly appreciate it.
Thanks,
Kyle
<?php require_once('Connections/EMALL.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Newsletter")) {
$insertSQL = sprintf("INSERT INTO Emailcollector (`Email Address`, City, `State`, Status, `Shipping Address`, Zip) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['EmailAddress'], "text"),
GetSQLValueString($HTTP_POST_VARS['City'], "text"),
GetSQLValueString($HTTP_POST_VARS['State'], "text"),
GetSQLValueString(isset($HTTP_POST_VARS['Subscribe']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($HTTP_POST_VARS['Address'], "text"),
GetSQLValueString($HTTP_POST_VARS['Zip'], "text"));
mysql_select_db($database_EMALL, $EMALL);
$Result1 = mysql_query($insertSQL, $EMALL) or die(mysql_error());
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Newsletter")) {
$insertSQL = sprintf("INSERT INTO Emailcollector (`Email Address`, City, `State`, Status, `Shipping Address`, Zip) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['EmailAddress'], "text"),
GetSQLValueString($HTTP_POST_VARS['City'], "text"),
GetSQLValueString($HTTP_POST_VARS['State'], "text"),
GetSQLValueString(isset($HTTP_POST_VARS['Subscribe']) ? "true" : "", "defined","'Y'","'N'"),
GetSQLValueString($HTTP_POST_VARS['Address'], "text"),
GetSQLValueString($HTTP_POST_VARS['Zip'], "text"));
}
?>
<?php
$Sendmail = Mail ($EmailAddress,"AmericanEmall Newsletter","From:Sales@americanemall.com\r\n",
"Reply-To: [email]sales@americanemall.com[/email]\r\n");
$EmailAddress = GetSQLValueString($HTTP_POST_VARS['EmailAddress'], "text");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
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=MM_findObj(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 == '');
}
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
//-->
</script>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" name="Newsletter" target="_blank" id="Newsletter" onSubmit="MM_validateForm('EmailAddress','','RisEmail','Address','','R','City','','R','State','','R','Zip','','R');MM_popupMsg('You have successfully been subscribed to our Email list.. You should expect to receive your free gift within (30) days. Unsubscribe information is located at the bottom of the email that you will receive. Thank You, Nevada Matters & Associates.');return document.MM_returnValue">
<p align="center"><font color="#0000FF" size="6"><em><strong>AmericanEmall Newsletter
</strong> </em></font></p>
<p align="center"><font size="4">(Subscribe Now and receive 30day supply of
total nutritional tablets, compliments of Great Earth Vitamins in Reno, NV.)
</font></p>
<p align="center">Email Address:
<input name="EmailAddress" type="text" id="EmailAddress">
</p>
<p align="center"> Subscribe
<input name="Subscribe" type="checkbox" id="Subscribe" value="checkbox" checked>
</p>
<p align="center">Shipping Address:
<input name="Address" type="text" id="Address" value="">
</p>
<p align="center"> City:
<input name="City" type="text" id="City">
State:
<input name="State" type="text" id="State">
Zip:
<input name="Zip" type="text" id="Zip">
</p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</p>
<p align="center"><font color="#FF0000"><em>*Please note, we do not sell or
give out any information on our customers to anyone. All information that
is received, is remained confidential and only for the use of <font color="#0000FF">[url]www.americanemall.com.[/url]</font></em></font></p>
<input type="hidden" name="MM_insert" value="Newsletter">
</form>
</body>
</html>