PDA

View Full Version : HERE is my PHP SCRIPT


mursallo
08-13-2011, 07:12 PM
Previous message I put my HTML Code and now this is the PHP Script which iam having problem its not responding to a email don't know why can someone help me please. Thanks

Mursallo



<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "@gmail.com (mursallo@gmail.com)";
$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();
}

// validation expected data exists
if(!isset($_POST['First Name']) ||
!isset($_POST['Last Name']) ||
!isset($_POST['City']) ||
!isset($_POST['Province']) ||
!isset($_POST['Postal Code'])) {
!isset($_POST['Email Address']) ||
!isset($_POST['Work Phone']) ||
!isset($_POST['Mobile Phone']) ||


!isset($_POST['BusinessCards']) ||
!isset($_POST['Brochures']) ||
!isset($_POST['FlyerDesign']) ||
!isset($_POST['PageLayout']) ||
!isset($_POST['PosterDesign']) ||
!isset($_POST['Videography']) ||

!isset($_POST['TShirtDesign']) ||
!isset($_POST['RandomDesign']) ||
!isset($_POST['WebDesign']) ||
!isset($_POST['Photography']) ||
!isset($_POST['SEO']) ||
!isset($_POST['comments']) ||





died('We are sorry, but there appears to be a problem with the form you submitted.');
}

$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$city = $_POST['city']; // required
$province = $_POST['province']; // required
$postal_code = $_POST['postal_code']; // required
$email_address = $_POST['email_address']; // required
$work_phone = $_POST['work_phone']; // not required
$mobile_phone = $_POST['mobile_phone']; // required



$business_cards = $_POST['business_cards']; // required
$flyer_design = $_POST['flyer_design']; // required
$page_layout = $_POST['page_layout']; // not required


$poster_design = $_POST['poster_design']; // required
$videography = $_POST['videography']; // required
$tshirt_design = $_POST['tshirt_design']; // not required


$random_designn = $_POST['random_design']; // required
$web_design = $_POST['web_design']; // required
$photography = $_POST['photography']; // not required


$seo = $_POST['seo']; // required
$comments = $_POST['comments']; // required



$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$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 .= "Province: ".clean_string($province)."\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 .= "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 .= "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
}
?>

mursallo
08-13-2011, 07:14 PM
Here is my HTML CODE Please can someone help me thanks......



<form name="contactform" method="post" action="send_form_email.php (http://www.mxstudio.ca/send_form_email.php)">
<div align="center">
<table width="720">


<tbody><tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px; font-family: 'Helvetica Neue', Helvetica, Verdana, sans-serif;">
First Name
<font color="#CC3300">*</font></td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="First Name" name="FirstName" id="FirstName" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Last Name
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Last Name" name="LastName" id="LastName" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
City
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="City" name="City" id="City" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">Province<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">

<select name="State">
<option value="O">Ontario</option>
<option value="Q">Quebec</option>
<option value="NS">Nova Scotia</option>
<option value="NB">New Brunswick</option>
<option value="M">Manitoba</option>
<option value="BC">British Columbia</option>
<option value="PI">Prince Edward Island</option>
<option value="S">Saskatchewan</option>
<option value="A">Alberta</option>
<option value="NL">Newfoundland and Labrador</option>



</select>
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Postal Code
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Postal Code" name="Postalcode" id="Postalcode" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Email Address
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Email Address" name="EmailAddress" id="EmailAddress" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Work Phone
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Work Phone" name="WorkPhone" id="WorkPhone" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Mobile Phone
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Mobile Phone" name="MobilePhone" id="MobilePhone" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="50" colspan="2">
</td>
</tr>
</tbody></table>
</div>




<table width="720" border="0" cellpadding="0" cellspacing="0">

<tbody><tr>
<td width="720" height="50" colspan="7" bgcolor="#000000" style="font-size:18px; font-family:Futura, Arial, sans-serif; color:#FFFF00; padding-left:10px;">
<span style="text-transform:capitalize; letter-spacing:1px;">
What Services Are You Interested In?
</span> (Please Check ALL That Apply)

</td>
</tr>

<tr><td width="720" height="40" 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/portfoli-bgB.jpg">
Business Cards
</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/orangebox.jpg">
Brochures
</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">
Flyer 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/greenbg.jpg">
Logo Design
</td>
</tr>

<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="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"><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"><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">
<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">
<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"> <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"> <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"> <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"> <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"> <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"> <img src="images/form-SEO.jpg" width="170" height="177" alt="SEO"></td>
</tr>

</tbody></table>


<br><br><br><br>


<table width="720">

<tbody><tr>
<td width="720" colspan="2" height="50" style="background-color:#000000; color:#FFFF00; font-size:18px; font-family:Futura, Arial, sans-serif; padding-left:10px;">
<span style="text-transform:capitalize; letter-spacing:1px;">
Please select any or all of the services that you are interested in
</span>
</td>
</tr>




<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
Is This For Personal Or Commercial Purposes?
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Personal Or Commercial" name="PersonalCommercial" id="PersonalCommercial" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
This Job Should Be Completed NO LATER Than
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Job To Be Completed By" name="CompletedBy" id="CompletedBy" type="text">
</td>
</tr>
<tr>
<td wiidth="720" height="15" colspan="2">
</td>
</tr>
<tr>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
How Did You Find Out About Us? (Referral, Google..etc..)
<font color="#CC3300">*</font>
</td>
<td wiidth="360" height="35" valign="center" align="left" style="font-size:16px; padding-right:8px;">
<input style="background-color:#E4EFF1; height: 25px; width: 210px; font-size: 14px; vertical-align: middle; text-transform: capitalize;" maxlength="150" title="Referral" name="Referral" id="Referral" type="text">
</td>
</tr>


<tr>
<td wiidth="720" height="45" colspan="2">
</td>
</tr>


<tr>
<td wiidth="720" height="35" colspan="2" style="font-size:16px;">
Please Feel Free To Leave Any Special Instructions Or Comments In The Box Below.
</td>
</tr>

<tr>
<td wiidth="720" colspan="2">
<textarea style="width:700px; height:200px; font-size: 14px; vertical-align: middle; background-color:#E4EFF1; text-transform: capitalize;" name="Your_Message" id="Your_Message" maxlength="2000"></textarea>
</td>
</tr>
<tr>
<td wiidth="720" height="55" colspan="2">
</td>
</tr>
<tr>
<td wiidth="720" height="55" colspan="2" align="center">
<input type="submit" value=" Submit Form ">
</td>
</tr>
<tr>
<td wiidth="720" height="55" colspan="2">
</td>
</tr>
</tbody></table>
</form>

</td>
</tr>
<tr>
<td width="780" height="20"></td>
</tr>
</tbody></table>
</td>

Corrosive
08-14-2011, 11:11 AM
What is the nature of the error you are getting please?

mursallo
08-14-2011, 05:39 PM
the form is not working i dont know why......so iam asuming i did something wrong either php script or someone in html code......

edbr
08-15-2011, 02:54 AM
is the mail sending at all?
the form names do not all match \ie
$random_designn = $_POST['random_design']; // required
$web_design = $_POST['web_design']; // required
$photography = $_POST['photography']; // not required


while the forms are
RandomDesign" WebDesign Photography

this will thro errors so you need to work through and make sure they match. and of course you need to make sure the server has php . what is the URL?

mursallo
08-15-2011, 09:25 PM
Hello again,
No I don't receive any mail, when I fill up the form all i see is white blank page thats it...Those names are different cuz I got different section for RandomDesign WebDesign and Photography. The script is in php in server... You probly lost here take a look at the link below this is how the form look like....

http://www.mxstudio.ca/requestquote.html

Let me know if u need more info and thanks for your time for helping me precaite your help ....

Mursallo

edbr
08-16-2011, 01:08 AM
ok just wanted to clear the possibles before spending time on it , ill copy it and have a look later,

edbr
08-16-2011, 01:55 AM
its because you dont have a field 'email' in your form, the whole script is conditional on that

if(isset($_POST['email'])) {
your script

}

so either add a field or delete the condition including the final brace at the end

edbr
08-16-2011, 05:23 AM
the form is sending the following array
Array
(
[FirstName] =>
[email] =>
[LastName] =>
[City] =>
[State] => O
[Postalcode] =>
[EmailAddress] =>
[WorkPhone] =>
[MobilePhone] =>
[PersonalCommercial] =>
[CompletedBy] =>
[Referral] =>
[Your_Message] =>
)

however the values do not match in all cases make sure all form fields are named the same as your $_POST values or it will throw errors

mursallo
08-16-2011, 08:50 PM
Hello again,

Okay I remove the script if(isset($_POST['email'])) { fromt the top and brace on the bottom nuthing happen...okay regarding the field and post name I didn't catch you proper do you mind show me by changing one or two field post... so i can see how u did it .....thanks again iam very sorry to be some iddiot person on the web to you .....iam still learning PHP thanks.....

Mursallo

edbr
08-17-2011, 04:47 AM
ok but no computers today. independance day here from the dutch, so i have to stay near the pool ;)

mursallo
08-17-2011, 05:37 AM
Sure no problem take ur time.. happy independance day..

Mursallo

edbr
08-18-2011, 08:53 AM
ok try this , i removed the expected string as they wile be there anyway. better to approach this with a hiddn field value if you want more security.

re named fields you MUST match them. I havent tested mail function but it should be ok now

<!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>Untitled Document</title>
</head>

<body><?php



// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "ffe@gmail.com";
$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
$postal_code = $_POST['postal_code']; // required
$email_address = $_POST['EmailAddress']; // required
$work_phone = $_POST['WorkPhone']; // not required
$mobile_phone = $_POST['MobilePhone']; // 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 .= "Province: ".clean_string($province)."\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 .= "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 .= "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.


</body>
</html>

mursallo
08-19-2011, 12:16 AM
OKay first of all thanks again, you save my life lolz for helping me...okay I receive email but here is the another problem I got I don't receive the full form.....Iam not receiving the PROVINCE, NONE OF THE CHECK BOXES SECTION, Is This For Personal Or Commercial Purposes?, This Job Should Be Completed NO LATER Than,How Did You Find Out About Us? (Referral, Google..etc,

Basicaly all i received is this below:

First Name: william
Last Name: mursallo
City: toronto
Postal Code: m3c5g7
Email Address: mursallotest@Msn.com
Work Phone: 9058576584
Mobile Phone: 4167859635
Comments: just testing the email

The rest iam not sure I try to change the field name after doing it nuthing happen the whole form stop working so Iam 100% percent sure the field name for the rest I did something wrong.....do you mind please if u fixed or reveiw it and let me know....honestly I spend 3 hour still can't figure it out, Iam about to lose my mind in this PHP form.......thanks

check the link http://www.mxstudio.ca/requestquote.html
Mursallo....

edbr
08-19-2011, 01:08 AM
check your form
. i showed you the POST values being passed . as for check boxes you will have to add [] to your form field name to pass them as an array

mursallo
08-19-2011, 04:09 AM
Okay alrite Iam kinda picking up now lolz after so many lesson from you I really precaite your help your time....Okay I got all the message in my email but here is my qestion iam getting all the check boxes in email...like for example I only check one on the form...when I check email I have all the boxes listed do u know why??? below here is the changes I made on post for rest of them....

<?php

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = mursallotest@msn.com (mursallotest@msn.com);
$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
$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 .= "Province: ".clean_string($province)."\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
?>

mursallo
08-20-2011, 06:36 AM
my checkboxes still they all show in email togather dont know why even tho i put this [] on field name take a look is it how suppose to be or no??

<tr>
<td width="170" height="177" valign="bottom" align="center">
<input type="CHECKBOX" name="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[]"><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[]"><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>

I didn't change anything in php code......

mursallo
08-20-2011, 07:28 AM
<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>

mursallo
08-21-2011, 04:03 PM
I gues you got upset from qestion and you dont want to answer anymore but anywyz I really precaite you time and help....you help me alot honestly I'm very new to this PHP learn alot from you thank you so much for everything.....thanks

Mursallo.....

Mursallo

edbr
08-22-2011, 01:19 AM
not at all just am not on call 24/7/ i run 3 different businesses as well as helping here.
your checkbox is not correct in the form
should be
<input type="CHECKBOX" name="type[]" value="SEO">
<input type="CHECKBOX" name="type[]"value="Photography" ">

etc... then your value's selected will be passed as $_post['type']

mursallo
08-24-2011, 08:47 PM
Sure no problem thanks for your reply tho....is my php code should be like this or no ....

if (isset($_POST['type']) && is_array($_POST['types']))
{
$aServices = array_map('clean_string', $_POST['type']);
$sServices = implode(', ', $aServices);
$email_message .= 'Selected Services: ' . $sServices;
}


Mursallo...

edbr
08-25-2011, 12:58 AM
for what purpose? have you corrected the checkbox mistakes in your form?

mursallo
08-25-2011, 09:17 PM
the php code but i corrected the check box problem...I'm getting all message in the email now...thanks for your help....

edbr
08-26-2011, 12:31 AM
good , you are welcome

mursallo
08-27-2011, 06:21 PM
thanks for your help but here another small issue I got on my another instant message form... iam not getting my box down select menu... here is my html and php code.

MY HTML CODE

<form name="contactform" method="post" action="http://www.mxstudio.ca/instantrequestemail.php">

<font color="#ffffff">INTERESTS:</font><br>
<select id="Interestedin" size="1" title="Interestedin " name="Interestedin" style="height: 25px; width: 210px; font-size: 14px; vertical-align: middle; background-color:#ffffff; text-transform: capitalize;">
<option value="">Choose Option</option>
<option value="Business Card Design">Business Card Design</option>
<option value="Flyer Design">Flyer Design</option>
<option value="Logo Design">Logo Design</option>
<option value="Web Design">Web Design</option>
<option value="Photography">Photography</option>
<option value="Social Website Design">Social Website Design </option>
<option value="Photography">Photography</option>
<option value="Videography wedding">Videography wedding </option>
<option value="Sweet Sixteens">Sweet Sixteens</option>
<option value="Music Videos">Music Videos</option>
<option value="Tv Commercial Production">Tv Commercial Production</option>
<option value="Artist Biography">Artist Biography</option>
<option value="Special Events">Special Events</option>


</select>
<br>

<input type="submit" value=" Submit Form ">
</form>



MY PHP CODE

<?php
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "mursallotest@gmail.com";
$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();
}

$full_name = $_POST['FullName']; // required
$email = $_POST['Email']; // required
$phone = $_POST['Phone']; // required
$postal_code = $_POST['PostalCode']; // required
$interested = $_POST['Interested']; // required
$comments = $_POST['Your_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 .= "Full Name: ".clean_string($full_name)."\n";
$email_message .= "Email: ".clean_string($email)."\n";
$email_message .= "Phone: ".clean_string($phone)."\n";
$email_message .= "Postal Code': ".clean_string($postal_code)."\n";
$email_message .= "Interested: ".clean_string($interested)."\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.


This is what I get in my email form

Form details below.

Full Name: john
Email: mursallotest@gmail.com (mursallotest@gmail.com)
Phone: 4164258695 (tel:4164258695)
Postal Code': m3c1e6
Interested:
Comments: just testing thank you

Iam missing Interseted section Don't know why can u tell me what I'm doing wrong here if you dont mind...

edbr
08-27-2011, 11:56 PM
Intrestedin not intrested as you refer to as your post variable

mursallo
08-28-2011, 09:09 PM
Sorry its actually Interseted I fixed it but I still in the email it doesn't show me the Interseted Menu don't know why below is the HTML and PHP Code....

html code

<font color="#ffffff">INTERESTS:</font><br>
<select id="Interested" size="1" title="Interested" name="Interested" style="height: 25px; width: 210px; font-size: 14px; vertical-align: middle; background-color:#ffffff; text-transform: capitalize;">
<option value="">Choose Option</option>
<option value="Business Card Design">Business Card Design</option>
<option value="Flyer Design">Flyer Design</option>
<option value="Logo Design">Logo Design</option>
<option value="Web Design">Web Design</option>
<option value="Photography">Photography</option>
<option value="Social Website Design">Social Website Design </option>
<option value="Photography">Photography</option>
<option value="Videography wedding">Videography wedding </option>
<option value="Sweet Sixteens">Sweet Sixteens</option>
<option value="Music Videos">Music Videos</option>
<option value="Tv Commercial Production">Tv Commercial Production</option>
<option value="Artist Biography">Artist Biography</option>
<option value="Special Events">Special Events</option>


</select>
<br>


PHP CODE


<?php
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "mursallotest@gmail.com";
$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();
}


$full_name = $_POST['FullName']; // required
$email = $_POST['Email']; // required
$phone = $_POST['Phone']; // required
$postal_code = $_POST['PostalCode']; // required
$interested = $_POST['Interested']; // required
$comments = $_POST['Your_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 .= "Full Name: ".clean_string($full_name)."\n";
$email_message .= "Email: ".clean_string($email)."\n";
$email_message .= "Phone: ".clean_string($phone)."\n";
$email_message .= "Postal Code': ".clean_string($postal_code)."\n";
$email_message .= "Interested: ".clean_string($interested)."\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.



Form details below.

Full Name: john
Email: spanish_boy786@hotmail.com (spanish_boy786@hotmail.com)
Phone: 4164258695
Postal Code': m3c1e6
Interested:
Comments: just testing thank you...