Creating php file
http://www.milesmemorials.com/estimator.html
im trying created php file (estimate-to-email.php) go page information selected including values of selections sent in email. but! im not sure how collect informations in sections calculate if chosen example - 'additional services' created, 'burial' (plus info within section) , 'cremation' (again plus info within section)?
this ive created far. (ive left out sections im not sure about)
<?php
if(!isset($_post['submit']))
{
//this page should not accessed directly. need submit form.
echo "error; need submit form!";
}
$cat_custom_76922 = $_post['cat_custom_76922'];
$cat_custom_00000 = $_post['cat_custom_00000'];
$cat_custom_76926 = $_post['cat_custom_76926'];
$cat_custom_76924 = $_post['cat_custom_76924'];
$cat_custom_76927 = $_post['cat_custom_76927'];
$firstname = $_post['firstname'];
$lastname = $_post['lastname'];
$emailaddress= $_post['emailaddress'];
$homeaddress = $_post['homeaddress'];
$homecity = $_post['homecity'];
$homestate = $_post['homestate'];
$homezip = $_post['homezip'];
$homecountry = $_post['homecountry'];
$homephone = $_post['homephone'];
$cellphone = $_post['cellphone'];
//validate first
if(empty($cat_custom_76922)||empty($cat_custom_00000)||empty($cat_cust om_76926)||empty($cat_custom_76924)||empty($cat_custom_76927)||empty($ firstname)||empty($lastname)||empty($emailaddress)||empty($homeaddress )|empty($homecity)|empty($homestate)|empty($homezip)|empty($homecountr y)|empty($homephone)||empty($cellphone))
{
echo "please make sure fields filled in!";
exit;
}
if(isinjected($emailaddress))
{
echo "bad email value!";
exit;
}
$email_from = '$emailaddress';//<== update email address
$email_subject = "estimate m&d website";
$email_body .= "name: $firstname.\n";
$email_body .= "surname: $lastname.\n";
$email_body .= "address: $homeaddress.\n";
$email_body .= "city: $homecity.\n";
$email_body .= "county: $homestate.\n";
$email_body .= "postcode: $homezip.\n";
$email_body .= "country: $homecountry.\n";
$email_body .= "phone: $homephone.\n";
$email_body .= "mob: $cellphone.\n";
$email_body .= "removal milage: $cat_custom_76922.\n";
$email_body .= "viewing: $cat_custom_00000.\n";
$email_body .= "coffin: $cat_custom_76926.\n";
$email_body .= "route: $cat_custom_76924.\n";
$email_body .= "limousines: $cat_custom_76927.\n";
$to = "ness_rob@yahoo.com";//<== update email address
$headers = 'from: '.$emailaddress."\r\n";
$headers .='reply-to:'.$emailaddress."\r\n";
//send email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect payment page.
header('location: thankyou_estimate.html');
// function validate against email injection attempts
function isinjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0a+)',
'(%0d+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>
you might want fix spelling -
please click on thunmbnails view larger image & description of coffiins
and make sure understand dealing with, adjust code @ top of page -
<?php
if(!isset($_post['submit']))
{
//this page should not accessed directly. need submit form.
exit("error; need submit form!");
}
echo "<pre>";exit(print_r($_post));
tell me printed page after have filled out form random choices , submitted it.
More discussions in Dreamweaver support forum
adobe
Comments
Post a Comment