So, this is probably something really stupid, but Ive been racking my brain for hours trying to figure this out.
I simply want to add a check box that will send a copy of the email back to the person who filled out a form as a CC:
My form is,
<body>
<p>Sales Level 2 <a href="../billing/billinglevel2mailer.php">Billing Level 2</a> <a href="../claims/claimslevel2mailer.php">Claims Level 2</a> <a href="../adjusterinquiry/adjusterinquirymailer.php">Adjuster Inquiries</a></p>
<table width="800" border="1" bordercolor="000000" cellspacing="0" cellpadding="0">
<tr>
<td width="175" align="left" valign="top" background="sidebarpattern.png"><img src="sidebar.png" width="175" height="525" /></td>
<td align="left" valign="top">
<form
action="saleslevel2mailer_send.php"
method="post"
name="saleslevel2"
onsubmit="return validate(saleslevel2);">
<table width="800" border="1" cellpadding="5" cellspacing="0">
<tr>
<td width="400" align="right" valign="top"><font color="#FF0000">*</font>Your Email Address:</td>
<td width="400" align="left" valign="top"><input name="emailfrom" type="text" id="emailfrom" value="Your Email Address" onclick="this.value='';"/></td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Clients Name:</td>
<td align="left" valign="top"><input name="name" type="text" id="name" value="Clients Name" onclick="this.value='';"/></td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Policy Number:</td>
<td align="left" valign="top">
<input name="policynumber" type="text" id="policynumber" value="Policy Number" onclick="this.value='';"/></td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Clients Phone Number:</td>
<td align="left" valign="top"><input name="phonenumber" type="text" id="phonenumber" value="Phone Number" onclick="this.value='';"/></td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Reason for Escalation:</td>
<td align="left" valign="top">
<select name="issue" size="1">
<option value="" selected="selected">Select A Reason</option>
<optgroup label="Gift Confirmation/VOID Issues">
<option value="Gift Policy Not Activated">Gift Policy Not Activated/Extended</option>
<option value="Confirmation of Gift">Client Did Not Confirm Gift</option>
<option value="Gift Email Address Incorrect">Gift Email Address Incorrect</option>
<option value="Did not Receive Email">Did Not Receive Email</option>
<option value="Muiltiple Pets-Only One Email">Multiple Pets, Only got 1 EMail</option>
<option value="Server Issue">Server Issue</option>
<option value="Explanation/T&C">Explanation/T&C</option>
<option value="Confirmation/Extension Technical Error">Confirmation/Extension Technical Error</option>
</optgroup>
<optgroup label="Sales Issues">
<option value="Automatic Renewal">Automatic Renewal Not Advised</option>
<option value="Waiting Period">Waiting Period Not Advised</option>
<option value="Processed Incorrectly">Processed Incorrectly</option>
<option value="Incorrect Information Given">Incorrect Information Given</option>
<option value="Explanation/T&C">Explanation/T&C</option>
</optgroup>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Has the client purchased a policy with us already?:</td>
<td align="left" valign="top">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" width="50%">Yes</td><td align="left" width="50%">
<input type="radio" name="purchased" value="Yes" id="purchased_0" />
</td>
</tr>
<tr>
<td align="right">No</td><td align="left">
<input type="radio" name="purchased" value="No" id="purchased_1" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="right" valign="top"><font color="#FF0000">*</font>Have you ensured all information in the system is current and correct?:</td>
<td align="left" valign="top">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="right">Yes</td><td align="left" width="50%">
<input type="checkbox" name="infocheck" id="infocheck" value="Yes"/></td>
</tr>
</table></td>
</tr>
<tr>
<td align="right" valign="top">Notes or Additional Info.<br />(if necessary):</td>
<td align="left" valign="top"><textarea name="additionalinfo" id="additionalinfo" cols="55" rows="10"></textarea></td>
</tr>
</table><input type="submit" />
</form></td>
</tr>
</table>
</body>
and my page that does the mailing is...
PHP Code:
<?php
//$name = $_POST["email"];
$name = $_POST["name"];
$policynumber = $_POST["policynumber"];
$phonenumber = $_POST["phonenumber"];
$issue = $_POST["issue"];
$purchased = $_POST ["purchased"];
$infocheck = $_POST ["infocheck"];
$additionalinfo = $_POST ["additionalinfo"];
$email_to = "SalesLevel2@example.com"; // Who the email is to
$email_from = $_POST['emailfrom']; // Who the email is from
$email_subject = $policynumber.' - '.$issue; // The Subject of the email
$email_message = "Sales Level 2,".
$email_message = "\n\nPolicy Number: " .$policynumber.
$email_message = "\nClients Name: " .$name.
$email_message = "\nPhone Number: " .$phonenumber.
$email_message = "\nReason(s): " .$issue.
$email_message = "\nPurchased Already: " .$purchased.
$email_message = "\nAll info correct?: " .$infocheck.
$email_message = "\n\nAdditional Information: " .$additionalinfo. "\n\n\n\n". // Message that the email has in it
$headers = "From: ".$email_from;
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "<font face=verdana size=2><center>Your message has been sent<br> to Sales Level 2<br>
Click <a href=\"#\" onclick=\"history.back();\">here</a> to go back</center>";
} else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
?>
Id love to know what I am missing here, or where Ive gone wrong... But be gentle, lol, this is my first time playing with PHP...