attr('title','Booking Request'); $page->useJSFile('jquery.min.js'); $page->addJSFile('jquery-ui.min.js'); $page->addJSFile('default.js'); $page->addJSFile("bookingrequest.js"); $page->addCSSFile("smoothness/jquery-ui.css"); $page->addCSSFile("bookingrequest.css"); # the default template for this page is this one $page->content('bookingrequest.php'); # if the form has been submitted, then first present the information # to be reviewed by the user, then submit the information to John if(!empty($_POST)) { # go to the review page if the user has just clicked on Review Information # or, go to the form again with the information in it if the user clicked # on "Edit Information" if(isset($_POST['review_submit']) || isset($_POST['edit'])) { $page->data('info',$_POST); # only if we are moving to the review information page to we not display # the form if(isset($_POST['review_submit'])) $page->content('bookingrequest_review.php'); } # otherwise, we submit the form to john, since it has been reviewed else { # cobble together the message to send to john $message = ''; foreach($_POST as $key => $value) { # skip the buttons if($key == 'edit' || $key == 'submit' || $key == "FirstName" || $key == "MiddleName" || $key == "LastName" || $key == "Gender" || $key == "Birthdate") continue; $readable_key = ucfirst(str_replace('_',' ',$key)); $message .= str_repeat(" ", (27 - strlen($key) - 1)) . "$readable_key: $value\n"; } $spaces = str_repeat(" ", 15); for($idx = 0; $idx < count($_POST["FirstName"]); $idx++) { if(empty($_POST["FirstName"][$idx])) continue; $message .= $spaces . "Passenger " . ($idx + 1) . ": " . $_POST["FirstName"][$idx]; $message .= " " . $_POST["MiddleName"][$idx] . " " . $_POST["LastName"][$idx]; $message .= ", " . $_POST["Gender"][$idx] . ", " . $_POST["Birthdate"][$idx]; $message .= "\n"; } # send the e-mail, print success message if successful if(mail($CONFIG['email'],'Booking Request Received', $message, "From: {$CONFIG['email']}\r\nReply-To: {$_POST['email_address']}")) { $page->addMessage('Your request has been sent, thank you. You will hear from us within 3 business days, or sooner.'); } # if the e-mail did not succeed, give the post data to the table # and print an error message else { $page->addError('We could not send your request at this time. Please try again later.'); $page->data('info',$_POST); $page->content('bookingrequest_review.php'); } } } $page->process(); ?>