The only way I know of doing it is
Code: Select all
if(strlen($value[$z])>0)
$MsgBody .= "$Field: $value\n\n";Code: Select all
<?php
foreach($_POST as $key => $value){
if (is_array($value)) {
$_values[$key] = join("%,% ",$value);
}else $_values[$key] = $value;
$_values[$key]=stripslashes($_values[$key]);
}
if (!isset($_POST["_referer"])) {
$_referer = $HTTP_SERVER_VARS["HTTP_REFERER"];
}else $_referer = $_POST["_referer"];
function Display_Selected($_field, $_value){
$array = split("%,% ",$_field);
foreach($array as $key){
if ($key == $_value) {
echo "selected";
break;}}}
function Display_Radio($_field, $_value){
$st = "<input type=\"radio\"";
if (isset($_field)){if ($_field == $_value) {
$st .= " checked";}}
$st .= " disabled>";
return $st;}
function IsThereErrors($form) {
global $_POST, $_FILES, $_values;
$req[0][] = "Name";
$req[0][] = "Business_name";
$req[0][] = "Address";
$req[0][] = "Email";
$email[0][] = "Email";
$req[0][] = "Telephone";
$req[0][] = "FAO";
$flag = false;
for($i=0;$i<Count($req[$form]);$i++){
if ($_POST[$req[$form][$i]]=="") {
$flag = true;}}
for($i=0;$i<Count($email[$form]);$i++){
if (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/',$_POST[$email[$form][$i]]) && $_POST[$email[$form][$i]]!=""){
$flag = true;}}
return $flag;}
function display_errors($form, $_isdisplay) {
global $_POST, $_FILES;
$req[0][] = "Name";
$req[0][] = "Business_name";
$req[0][] = "Address";
$req[0][] = "Email";
$email[0][] = "Email";
$req[0][] = "Telephone";
$req[0][] = "FAO";
if ($_isdisplay) {
echo "<p align=\"center\"><font color=\"red\" face=\"Verdana, Arial, Helvetica, sans-serif\" Size=\"2\">";
for($i=0;$i<Count($req[$form]);$i++){
if ($_POST[$req[$form][$i]]=="") {
echo "<br> ERROR: Field <b>".$req[$form][$i]."</b> is required!";}}
for($i=0;$i<Count($email[$form]);$i++){
if (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/',$_POST[$email[$form][$i]]) && $_POST[$email[$form][$i]]!=""){
echo "<br> ERROR: <b>'".htmlspecialchars($_POST[$email[$form][$i]])."'</b> is not valid email address!";}}
echo "</font></p>";}}
// Snip all the required fields, HTML, etc...
// Return at beginning of notifier email
function SendEmails(){
global $_values, $zag, $un;
$un = strtoupper(uniqid(time()));
$to[0] .= "nnnnn@nnnnnnn.co.uk";
$subject[0] .= "Quotation";
$head[0] = "From: ".str_replace("%,%", ",", $_values['Email'])."\n";
$head[0] .= "Subject: Quotation\n";
$head[0] .= "Reply-To: ".str_replace("%,%", ",", $_values['Email'])."\n";
$head[0] .= "Content-Type:multipart/mixed;";
$head[0] .= "boundary=\"".$un."\"\n\n";
$EmailBody = "A quotation has been requested for the following:
// And this is an example of one of the items put into the email body
Galvanised Sheets:
".str_replace("%,%", ",", $_values['1_Galvanised_Sheets_Quantity']) ."".str_replace("%,%", ",", $_values['1_Galvanised_Sheets_Size'])."
".str_replace("%,%", ",", $_values['2_Galvanised_Sheets_Quantity']) ."".str_replace("%,%", ",", $_values['2_Galvanised_Sheets_Size'])."
".str_replace("%,%", ",", $_values['3_Galvanised_Sheets_Quantity']) ."".str_replace("%,%", ",", $_values['3_Galvanised_Sheets_Size'])."
// followed by
BuildBody($EmailBody, False, 1);
for ($i=0;$i<=1;$i++){
mail($to[$i], $subject[$i], $zag[$i], $head[$i]);
}
}
$actions = array ("display_quote","display_preview","redirect_to");
if (isset($_POST["_next_page"])) {
$_next_page = $_POST["_next_page"];
}else $_next_page = 0;
if ($_POST["submit"]=="back") {
call_user_func($actions[$_next_page-2],false);
}else if (IsThereErrors($_next_page-1)){
call_user_func($actions[$_next_page-1],true);
}else {
call_user_func($actions[$_next_page+0],false);
if ($_next_page == count($actions)-1) {
SendEmails();
}
}
?>