';
if(!$fullname){
echo "Name is a required field. Please enter it below or click on the back button in your browser to go back to your completed reservation page.
";
}
if(!$email){
echo "Email Address is a required field. Please enter it below or click on the back button in your browser to go back to your completed reservation page.
";
}
if(!$numberadults){
echo "The Number of Persons is a required field. Please enter it below or click on the back button in your browser to go back to your completed reservation page.
";
}
if(!$maximumbudget){
echo "Maximum budget is a required field. Please enter it below or click on the back button in your browser to go back to your completed reservation page.
";
}
header(sprintf("Location: %s", $editFormAction)); // Show the form again!
} else { /* Check if the email address used in the reservation form already exists in the database */
mysql_select_db($database_connApartExchange, $connApartExchange);
$sql_email_check = mysql_query("SELECT email FROM sydney_reservations
WHERE email='$email'AND resv_status!='Archived'") or die("Invalid query: " . mysql_error());
$email_check = mysql_num_rows($sql_email_check);
if(($email_check > 0)){
$insertGoTo = "oncemore.htm";
header(sprintf("Location: %s", $insertGoTo)); // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
}else {
/* If it enters this part of the logic then the reservation is for the first time.
Proceed to extract all the information and insert into the DBase.
*/
// Convert arrival & departure dates into SQL "date" format
$arrivaldate = date( Ymd, mktime( 0, 0, 0, $_POST['arrivalmonth'], $_POST['arrivalday'], $_POST['arrivalyear']) );
$departdate = date( Ymd, mktime( 0, 0, 0, $_POST['departuremonth'], $_POST['departureday'], $_POST['departureyear']) );
// Type of budget - weekly or monthly
$budgettype = $_POST["weekly-monthlybudget"];
// Country
$country = $_POST["country"];
// Telephone
$telephone = $_POST["telephone"];
// Fax
$fax = $_POST["fax"];
// Preferred area
$firstprefdistrict = $_POST["1stprefdistrict"];
$secondprefdistrict = $_POST["2ndprefdistrict"];
$thirdprefdistrict = $_POST["3rdprefdistrict"];
// Type of apartment - studio, 1-bedroom, etc
$apartmenttype = $_POST["apartment-type"];
// Preferred apartment
$firstchoiceapart = $_POST["1stchoiceapart"];
$secondchoiceapart = $_POST["2ndchoiceapart"];
$thirdchoiceapart = $_POST["3rdchoiceapart"];
// Priority of choice - price, location, beds, etc
$priorityofchoice = $_POST["priority"];
// Additional info
$addinfo = $_POST["addinfo"];
// Other information
$numberchildren = $_POST["numberchildren"];
$bedsneeded = $_POST["bedsneeded"];
mysql_select_db($database_connApartExchange, $connApartExchange);
$sql = mysql_query("INSERT INTO sydney_reservations (fullname,
email,
telephone,
fax,
country,
arrivaldate,
departdate,
requestdate,
modifydate,
numberadults,
numberchildren,
bedsneeded,
budgettype,
maximumbudget,
1stprefdistrict,
2ndprefdistrict,
3rdprefdistrict,
addinfo,
aparttype,
1stchoiceapart,
2ndchoiceapart,
3rdchoiceapart,
priority)
VALUES('$fullname',
'$email',
'$telephone',
'$fax',
'$country',
'$arrivaldate',
'$departdate',
now(),
now(),
'$numberadults',
'$numberchildren',
'$bedsneeded',
'$budgettype',
'$maximumbudget',
'$firstprefdistrict',
'$secondprefdistrict',
'$thirdprefdistrict',
'$addinfo',
'$apartmenttype',
'$firstchoiceapart',
'$secondchoiceapart',
'$thirdchoiceapart',
'$priorityofchoice')") or die ("Invalid query: " . mysql_error());
/* Prepare email to send to ApartRentals for this reservation request */
$body = sprintf("
Reservation Request for Sydney
Full Name: %1\$s
Email: %2\$s
Telephone: %3\$s
Fax: %4\$s
Country: %5\$s
Arrival date: %6\$s
Departure date: %7\$s
Budget:-
Budget Type: %8\$s
Max Budget(AUD): %9\$d
Size of Group:-
Number of adults: %10\$d
Number of children: %11\$d
Beds needed: %12\$d
Apartment is listed/not listed on website: %13\$s
Listed Apartment:-
1st choice apartment: %14\$s
2nd choice apartment: %15\$s
3rd choice apartment: %16\$s
Not Listed Apartment (preferences):-
1st preferred district: %17\$s
2nd preferred district: %18\$s
3rd preferred district: %19\$s
Apartment type: %20\$s
Priority of choice: %21\$s
Additional Information:
%22\$s
How did you hear about us?
Internet: %23\$s
Search Engine: %24\$s
Referral through website: %25\$s
Forum: %26\$s
Friends: %27\$s
Others: %28\$s
",
$fullname,
$email,
$telephone,
$fax,
$country,
date("l dS of F Y", mktime( 0, 0, 0, $_POST['arrivalmonth'], $_POST['arrivalday'], $_POST['arrivalyear']) ),
date("l dS of F Y", mktime( 0, 0, 0, $_POST['departuremonth'], $_POST['departureday'], $_POST['departureyear']) ),
$budgettype,
$maximumbudget,
$numberadults,
$numberchildren,
$bedsneeded,
$_POST["apartmentlisted-notlisted"],
$firstchoiceapart,
$secondchoiceapart,
$thirdchoiceapart,
$firstprefdistrict,
$secondprefdistrict,
$thirdprefdistrict,
$apartmenttype,
$priorityofchoice,
$addinfo,
$_POST["Internet-website"],
$_POST["Search-engine-name"],
$_POST["Name-of-referral-website"],
$_POST["Name-of-forum"],
$_POST["Friends-name"],
$_POST["other-details"]); // Also add the referral info fields later.
/* Send email to ApartExchange */
mymail('info@apartexchange.com', "Sydney Reservation Form", $body, $email);
/* Go to success page */
$insertGoTo = "success.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
} // End of else for email check in DBase
} // End of else for fullname, email, maxbudget, noofadults nullcheck
} // End of if isset(MM_INSERT) etc
?>

Reservation Form for Sydney
Please fill out this form and we will get back to you as soon as possible (* means required field)
ApartRentals