I am working on letting my client edit fields on their reservations form.
I have everything working properly in the form and the fields appear properly.
But the mail script is breaking.
Original Script
<?php
$tour=$_POST['tour'];
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$address=$_POST['address'];
$citystatezip=$_POST['citystatezip'];
$roomates=$_POST['roomates'];
$departure=$_POST['departure'];
$smoking=$_POST['smoking'];
$message=$_POST['message'];
$to='EMAIL ADDRESS';
$headers = 'From: '.$name."\r\n" .
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject ='Reservation From Rileytours.com';
$body='You have a reservation from Rileytours.com.'."\n\n";
$body.='Tour Name: '.$tour."\n";
$body.='Name: '.$name."\n";
$body.='Email: '.$email."\n";
$body.='Phone Number: '.$phone."\n";
$body.='Address: '.$address."\n";
$body.='City/State/Zip: '.$citystatezip."\n";
$body.='Roomate Name(s): '.$roomates."\n";
$body.='Departure City: '.$departure."\n";
$body.='Smoking Preference: '.$smoking."\n";
$body.='Special Request: '."\n".$message."\n";
if(mail($to, $subject, $body, $headers)) {
die("<img src=\"img/check green sm.png\" align=\"left\" hspace=\"5px\" /><strong>Thanks. Your reservation has been sent and someone will contact you with a confirmation shortly. <br/>
If you need immediate assistance please contact us at the phone numbers below.</strong>");
} else {
die('Oops! Your email failed for some reason. Please try it again and see if it will go through.<br/>
If it does not work again please contact us directly.');
}
?>
This is what I have but I know that I have the code from the CMS assembled wrong
<?php
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('D:/HostingSpaces/rileytours/rileytours.com/wwwroot/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
list($reservation_fieldsRecords, $reservation_fieldsMetaData) = getRecords(array(
'tableName' => 'reservation_fields',
'loadUploads' => false,
'allowSearch' => false,
));
$email=$_POST['email'];
foreach ($reservation_fieldsRecords as $record):
$echo htmlencode($record['title'])=$_POST ['echo htmlencode($record['form_field'])'];
endforeach
$departure=$_POST['departure'];
$smoking=$_POST['smoking'];
$message=$_POST['message'];
$to='EMAIL ADDRESS';
$headers = 'From: '.$fullname1."\r\n" .
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject ='Reservation From Rileytours.com';
$body='You have a reservation from Rileytours.com.'."\n\n";
$body.='Email: '.$email."\n";
foreach ($reservation_fieldsRecords as $record):
$body.='echo htmlencode($record['title']): '.$echo htmlencode($record['form_field']) ."\n";
endforeach
$body.='Departure City: '.$departure."\n";
$body.='Smoking Preference: '.$smoking."\n";
$body.='Special Request: '."\n".$message."\n";
if(mail($to, $subject, $body, $headers)) {
die("<img src=\"img/check green sm.png\" align=\"left\" hspace=\"5px\" /><strong>Thanks. Your reservation has been sent and someone will contact you with a confirmation shortly. <br/>
If you need immediate assistance please contact us at the phone numbers below.</strong>");
} else {
die('Oops! Your email failed for some reason. Please try it again and see if it will go through.<br/>
If it does not work again please contact us directly.');
}
?>
How should these lines be written?
Thanks for your help
Michael
Michael Moyers
Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.
"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"