my html code
<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="BusinessCards[]" value="BusinessCards"><img src="images/form-businesscards.jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Brochures[]" value="Brochures"><img src="images/form-brochures.jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="FlyerDesign[]" value="FlyerDesign"><img src="images/form-flyer-design.jpg".jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="LogoDesign"><img src="images/form-logo-design.jpg".jpg" border="0" alt=" /">
</td>
</tr>
<tr><td width="750" height="20" colspan="7"></td></tr>
<tr>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgC.jpg">
Page Layout
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfoliobgSky.jpg">
Poster Design
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoliobgSky.jpg">
Videography</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgGold.jpg">
T Shirt Design
</td>
</tr>
<tr>
<td width="170" height="177" valign="bottom" align="center"><input type="CHECKBOX" name="PageLayout[]" value="PageLayout">
<img src="images/form-page-layout.jpg" width="170" height="177" alt="page layout"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center"><input type="CHECKBOX" name="PosterDesign[]" value="PosterDesign">
<img src="images/form-poster-design.jpg" width="170" height="177" alt="poster design"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Videography[]" value="Videography"><img src="images/form-Videography.jpg" width="170" height="177" alt="Videography"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="TShirtDesign[]" value="TShirtDesign"><img src="images/form-tshirt-design.jpg" width="170" height="177" alt="Tshirt design"></td>
</tr>
<tr><td width="750" height="20" colspan="7"></td></tr>
<tr>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgP.jpg">
Media Commercial
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoli-bgB.jpg">
Web Design
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgC.jpg">
Photography
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoliobgM.jpg">
SEO
</td>
</tr>
<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="RandomDesign[]" value="RandomDesign"><img src="images/form-MediaCommercial .jpg" width="170" height="177" alt="Media Commercial"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="WebDesign[]" value="WebDesign"><img src="images/form-web-design.jpg" width="170" height="177" alt="Web Design"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Photography[]" value="Photography"><img src="images/form-photography.jpg" width="170" height="177" alt="Photography"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="SEO[]" value="SEO"><img src="images/form-SEO.jpg" width="170" height="177" alt="SEO"></td>
</tr>
And my php code
<?php
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Hello";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
$first_name = $_POST['FirstName']; // required
$last_name = $_POST['LastName']; // required
$city = $_POST['City']; // required
$state = $_POST['State']; // required
$o = $_POST['O']; // required
$q = $_POST['Q']; // required
$n_s = $_POST['NS']; // required
$n_b = $_POST['NB']; // required
$m = $_POST['M']; // required
$b_c = $_POST['BC']; // required
$p_i = $_POST['PI']; // required
$s = $_POST['S']; // required
$a = $_POST['A']; // required
$n_l = $_POST['NL']; // required
$postal_code = $_POST['Postalcode']; // required
$email_address = $_POST['EmailAddress']; // required
$work_phone = $_POST['WorkPhone']; // not required
$mobile_phone = $_POST['MobilePhone']; // required
$business_cards = $_POST['BusinessCards']; // required
$brochures = $_POST['Brochures']; // required
$flyer_design = $_POST['FlyerDesigne']; // not required
$logo_design = $_POST['LogoDesign']; // required
$page_layout = $_POST['PageLayout']; // required
$poster_design = $_POST['PosterDesign']; // required
$videography = $_POST['Videography']; // not required
$tshirt_design = $_POST['TShirtDesign']; // required
$random_design = $_POST['RandomDesign']; // required
$web_design = $_POST['Web Design']; // required
$photography = $_POST['Photography']; // not required
$seo = $_POST['SEO']; // required
$personal_commercial = $_POST['PersonalCommercial']; // required
$completed_by = $_POST['CompletedBy']; // required
$referral = $_POST['Referral']; // not required
$comments = $_POST['Your_Message'];
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_address)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "City: ".clean_string($city)."\n";
$email_message .= "State: ".clean_string($state)."\n";
$email_message .= "Ontario: ".clean_string($o)."\n";
$email_message .= "Quebec: ".clean_string($q)."\n";
$email_message .= "Nova Scotia: ".clean_string($n_s)."\n";
$email_message .= "New Brunswick: ".clean_string($n_b)."\n";
$email_message .= "Manitoba: ".clean_string($m)."\n";
$email_message .= "British Columbia: ".clean_string($b_c)."\n";
$email_message .= "Prince Edward Island: ".clean_string($p_i)."\n";
$email_message .= "Saskatchewan: ".clean_string($s)."\n";
$email_message .= "Alberta: ".clean_string($a)."\n";
$email_message .= "Newfoundland and Labrador:".clean_string($n_l)."\n";
$email_message .= "Postal Code: ".clean_string($postal_code)."\n";
$email_message .= "Email Address: ".clean_string($email_address)."\n";
$email_message .= "Work Phone: ".clean_string($work_phone)."\n";
$email_message .= "Mobile Phone: ".clean_string($mobile_phone)."\n";
$email_message .= "Business Cards: ".clean_string($business_cards)."\n";
$email_message .= "Brochures: ".clean_string($brochures)."\n";
$email_message .= "Flyer Design: ".clean_string($flyer_design)."\n";
$email_message .= "logo Design: ".clean_string($logo_design)."\n";
$email_message .= "Page Layout: ".clean_string($page_layout)."\n";
$email_message .= "Poster Design: ".clean_string($poster_design)."\n";
$email_message .= "Videography: ".clean_string($videography)."\n";
$email_message .= "TShirt Design: ".clean_string($tshirt_design)."\n";
$email_message .= "Random Design: ".clean_string($random_design)."\n";
$email_message .= "Web Design: ".clean_string($web_design)."\n";
$email_message .= "Photography: ".clean_string($photography)."\n";
$email_message .= "SEO: ".clean_string($seo)."\n";
$email_message .= "Personal Commercial: ".clean_string($personal_commercial)."\n";
$email_message .= "Completed By: ".clean_string($completed_by)."\n";
$email_message .= "Referral: ".clean_string($referral)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
?>
Iam getting email with all checkboxes name dont know why even tho when I check only one in the form but I get email it shows all of them....can someone please tell me what i have done wrong here ....thanks
<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="BusinessCards[]" value="BusinessCards"><img src="images/form-businesscards.jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Brochures[]" value="Brochures"><img src="images/form-brochures.jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="FlyerDesign[]" value="FlyerDesign"><img src="images/form-flyer-design.jpg".jpg" border="0" alt=" /">
</td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="LogoDesign"><img src="images/form-logo-design.jpg".jpg" border="0" alt=" /">
</td>
</tr>
<tr><td width="750" height="20" colspan="7"></td></tr>
<tr>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgC.jpg">
Page Layout
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfoliobgSky.jpg">
Poster Design
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoliobgSky.jpg">
Videography</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgGold.jpg">
T Shirt Design
</td>
</tr>
<tr>
<td width="170" height="177" valign="bottom" align="center"><input type="CHECKBOX" name="PageLayout[]" value="PageLayout">
<img src="images/form-page-layout.jpg" width="170" height="177" alt="page layout"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center"><input type="CHECKBOX" name="PosterDesign[]" value="PosterDesign">
<img src="images/form-poster-design.jpg" width="170" height="177" alt="poster design"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Videography[]" value="Videography"><img src="images/form-Videography.jpg" width="170" height="177" alt="Videography"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="TShirtDesign[]" value="TShirtDesign"><img src="images/form-tshirt-design.jpg" width="170" height="177" alt="Tshirt design"></td>
</tr>
<tr><td width="750" height="20" colspan="7"></td></tr>
<tr>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgP.jpg">
Media Commercial
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoli-bgB.jpg">
Web Design
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#000000; font-family:Futura, Arial, sans-serif" background="images/portfolio-bgC.jpg">
Photography
</td>
<td width="10"></td>
<td width="170" height="30" valign="center" align="center" style="font-size:17px; background-color:#cccccc; color:#ffffff; font-family:Futura, Arial, sans-serif" background="images/portfoliobgM.jpg">
SEO
</td>
</tr>
<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="RandomDesign[]" value="RandomDesign"><img src="images/form-MediaCommercial .jpg" width="170" height="177" alt="Media Commercial"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="WebDesign[]" value="WebDesign"><img src="images/form-web-design.jpg" width="170" height="177" alt="Web Design"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="Photography[]" value="Photography"><img src="images/form-photography.jpg" width="170" height="177" alt="Photography"></td>
<td width="10"></td>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="SEO[]" value="SEO"><img src="images/form-SEO.jpg" width="170" height="177" alt="SEO"></td>
</tr>
And my php code
<?php
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Hello";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
$first_name = $_POST['FirstName']; // required
$last_name = $_POST['LastName']; // required
$city = $_POST['City']; // required
$state = $_POST['State']; // required
$o = $_POST['O']; // required
$q = $_POST['Q']; // required
$n_s = $_POST['NS']; // required
$n_b = $_POST['NB']; // required
$m = $_POST['M']; // required
$b_c = $_POST['BC']; // required
$p_i = $_POST['PI']; // required
$s = $_POST['S']; // required
$a = $_POST['A']; // required
$n_l = $_POST['NL']; // required
$postal_code = $_POST['Postalcode']; // required
$email_address = $_POST['EmailAddress']; // required
$work_phone = $_POST['WorkPhone']; // not required
$mobile_phone = $_POST['MobilePhone']; // required
$business_cards = $_POST['BusinessCards']; // required
$brochures = $_POST['Brochures']; // required
$flyer_design = $_POST['FlyerDesigne']; // not required
$logo_design = $_POST['LogoDesign']; // required
$page_layout = $_POST['PageLayout']; // required
$poster_design = $_POST['PosterDesign']; // required
$videography = $_POST['Videography']; // not required
$tshirt_design = $_POST['TShirtDesign']; // required
$random_design = $_POST['RandomDesign']; // required
$web_design = $_POST['Web Design']; // required
$photography = $_POST['Photography']; // not required
$seo = $_POST['SEO']; // required
$personal_commercial = $_POST['PersonalCommercial']; // required
$completed_by = $_POST['CompletedBy']; // required
$referral = $_POST['Referral']; // not required
$comments = $_POST['Your_Message'];
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_address)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "City: ".clean_string($city)."\n";
$email_message .= "State: ".clean_string($state)."\n";
$email_message .= "Ontario: ".clean_string($o)."\n";
$email_message .= "Quebec: ".clean_string($q)."\n";
$email_message .= "Nova Scotia: ".clean_string($n_s)."\n";
$email_message .= "New Brunswick: ".clean_string($n_b)."\n";
$email_message .= "Manitoba: ".clean_string($m)."\n";
$email_message .= "British Columbia: ".clean_string($b_c)."\n";
$email_message .= "Prince Edward Island: ".clean_string($p_i)."\n";
$email_message .= "Saskatchewan: ".clean_string($s)."\n";
$email_message .= "Alberta: ".clean_string($a)."\n";
$email_message .= "Newfoundland and Labrador:".clean_string($n_l)."\n";
$email_message .= "Postal Code: ".clean_string($postal_code)."\n";
$email_message .= "Email Address: ".clean_string($email_address)."\n";
$email_message .= "Work Phone: ".clean_string($work_phone)."\n";
$email_message .= "Mobile Phone: ".clean_string($mobile_phone)."\n";
$email_message .= "Business Cards: ".clean_string($business_cards)."\n";
$email_message .= "Brochures: ".clean_string($brochures)."\n";
$email_message .= "Flyer Design: ".clean_string($flyer_design)."\n";
$email_message .= "logo Design: ".clean_string($logo_design)."\n";
$email_message .= "Page Layout: ".clean_string($page_layout)."\n";
$email_message .= "Poster Design: ".clean_string($poster_design)."\n";
$email_message .= "Videography: ".clean_string($videography)."\n";
$email_message .= "TShirt Design: ".clean_string($tshirt_design)."\n";
$email_message .= "Random Design: ".clean_string($random_design)."\n";
$email_message .= "Web Design: ".clean_string($web_design)."\n";
$email_message .= "Photography: ".clean_string($photography)."\n";
$email_message .= "SEO: ".clean_string($seo)."\n";
$email_message .= "Personal Commercial: ".clean_string($personal_commercial)."\n";
$email_message .= "Completed By: ".clean_string($completed_by)."\n";
$email_message .= "Referral: ".clean_string($referral)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
?>
Iam getting email with all checkboxes name dont know why even tho when I check only one in the form but I get email it shows all of them....can someone please tell me what i have done wrong here ....thanks
Comment