How can I add a check box to a php form to be emailed?
the html page:
<html>
<head>
<title>PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form
mailers)</title>
<style>
BODY{
color:#000000;
font-size: 8pt;
font-family: Verdana;
}
.button {background-color: rgb(128,128,128); color:#ffffff; font-size: 8pt;}
.inputc {font-size: 8pt;}
.style2 {font-size: 24pt}
.style3 {
font-size: 18pt;
font-weight: bold;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<form name="phpformmailer" action="contact.php" align="center" method="post">
<div align="center"><center>
<p> </p>
<p> </p>
<table width="449" border="1" id="tile">
<caption align="top">
<span class="style2"> Tile Samples
</span>
</caption>
<tr>
<td width="44"><a href="image032.jpg"><img src=image032.jpg
width=44 height=44 border="0" v:shapes="_x0000_s1413"></a></td>
<td width="71">X3593</td>
<td width="279">Blue Blend Mosaic</td>
<td width="27"><input name="X3593" type="checkbox" id="X35932" value="X3593"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image036.jpg v:shapes="_x0000_s1415"></td>
<td>X3596</td>
<td>Green Blend Mosaic</td>
<td><input name="X3596" type="checkbox" id="X35962" value="X3596"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image034.jpg v:shapes="_x0000_s1414"></td>
<td>X3590</td>
<td>Navy Blend Mosaic</td>
<td><input name="X3590" type="checkbox" id="X35902" value="X3590"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image030.jpg v:shapes="_x0000_s1412"></td>
<td>X3595</td>
<td>Brown Blend Mosaic </td>
<td><input name="X3595" type="checkbox" id="X35952" value="X3595"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image038.jpg v:shapes="_x0000_s1416"></td>
<td>XIR2535</td>
<td>Brushed Chrome Blue Blend Mosaic </td>
<td><input name="XIR2535" type="checkbox" id="XIR25352" value="XIR2535"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image044.jpg v:shapes="_x0000_s1419"></td>
<td>XIR2533</td>
<td>Brushed Chrome Green Blend Mosaic </td>
<td><input name="XIR2533" type="checkbox" id="XIR25332" value="XIR2533"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image042.jpg v:shapes="_x0000_s1418"></td>
<td>XIR2537</td>
<td>Brushed Chrome Navy Blend Mosaic </td>
<td><input name="XIR2537" type="checkbox" id="XIR25372" value="XIR2537"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image040.jpg v:shapes="_x0000_s1417"></td>
<td>XIR2531</td>
<td>Brushed Chrome Brown Blend Mosaic </td>
<td><input name="XIR2531" type="checkbox" id="XIR25312" value="XIR2531"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image048.jpg v:shapes="_x0000_s1421"></td>
<td>XST4956</td>
<td>Empress Blend Mosaic </td>
<td><input name="XST4956" type="checkbox" id="XST49562" value="XST4956"></td>
</tr>
<tr>
<td><img
width=44 height=44 src=image046.jpg v:shapes="_x0000_s1420"></td>
<td>XST5892</td>
<td>Sandstone Blend Mosaic </td>
<td><input name="XST5892" type="checkbox" id="XST5892" value="XST5892"></td>
</tr>
</table>
<p> </p>
<table width="528" height="489" cellspacing="6" bgcolor="#F2F2F2">
<tr>
<td width="159"><div align="center"></div></td>
<td width="349"><div align="left" class="style3">SAMPLE TILE ORDER </div></td>
</tr>
<tr>
<td align="right" width="159"><small>Your name:</small></td>
<td width="349"><font face="Arial"><input class="inputc" size="29" name="name"></font></td>
</tr>
<tr>
<td align="right" width="159"><font color="#000080" size="1">*</font><small> Your email
address:</small></td>
<td align="left" width="349"><font face="Arial"><input class="inputc" size="29"
name="email"></font></td>
</tr>
<tr align="middle">
<td align="right" width="159"><font color="#000080" size="1">*</font><small> Confirm email
address:</small></td>
<td width="349" align="left"><font face="Arial"><input class="inputc" size="29"
name="email2"></font></td>
</tr>
<tr>
<td align="right" width="159"><font color="#000080" size="1">*</font><small> Subject:</small></td>
<td width="349"><font face="Arial"><input name="thesubject" value="Tile Sample Order" size="29">
</font></td>
</tr>
<tr>
<td align="right" width="159"> <p><font color="#000080" size="1">*</font><small> Your
Address:</small></td>
<td width="349"><textarea style="FONT-SIZE: 10pt" name="themessage" rows="7" cols="27">
</textarea></td>
</tr>
<tr>
<td width="159"></td>
<td width="349"><script language="JavaScript"><!--
function validateForm()
{
var okSoFar=true
with (document.phpformmailer)
{
var foundAt = email.value.indexOf("@",0)
if (foundAt < 1 && okSoFar)
{
okSoFar = false
alert ("Please enter a valid email address.")
email.focus()
}
var e1 = email.value
var e2 = email2.value
if (!(e1==e2) && okSoFar)
{
okSoFar = false
alert ("Email addresses you entered do not match. Please re-enter.")
email.focus()
}
if (thesubject.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter the subject.")
thesubject.focus()
}
if (themessage.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter the details for your Adress.")
themessage.focus()
}
if (okSoFar==true) submit();
}
}
// --></script><input type="button" class="button"
value="Send" name="B1" ONCLICK="javascript:validateForm()"><small> <small>You must fill in
the fields marked with a *</small></small></td>
</tr>
</table>
</center></div>
</form>
</body>
</html>
the PHP page:
<?php
$valid_ref1="[http://intellisft.com/contact.html](http://intellisft.com/contact.html)";
$valid_ref2="[http://www.intellisft.com/contact.html](http://www.intellisft.com/contact.html)";
$replyemail="[EMAIL="sarant@intellisft.com"]sarant@intellisft.com[/EMAIL]";
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/
/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
return preg_replace($patterns, "", strtolower($value));
}
$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);
$error_msg='ERROR - not sent. Try again.';
$success_sent_msg='<p align="center"><strong> </strong></p>
<p align="center"><strong>Your order has been successfully sent to us<br>
</strong> and we will ship your sample out as soon as possible.</p>
<p align="center">A copy of your order has been sent to you.</p>
<p align="center">Thank you for your interest in our tiles.</p>';
$replymessage = "Hi $name
Thank you for your order.
We will endeavour to send a reply to you shortly.
Please DO NOT reply to this email.
Below is a copy of the sample order you submitted:
--------------------------------------------------
Subject: $thesubject
Order Address:
$themessage
--------------------------------------------------
Thank you";
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--
";
echo "top.location.href = \"$valid_ref1\";
// --></script>";
exit;
}
$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--
alert(\"$error_msg\");
";
echo "top.location.href = \"$valid_ref1\";
// --></script>";
exit;
}
$themessage = "Name: $name
Address: $themessage";
if($
mail("$replyemail",
"$thesubject",
"$themessage",
"From: $email
Reply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail
Reply-To: $replyemail");
echo $success_sent_msg;
?>