| px | top | add code | search | signup | login | help |
This file figures motel room rates on 5 different type rooms dependent on #adults, #children, and #days spent.
//
Below is the php code implanted in html file. Php data is placed in file with tags such as: <?php echo $NightlyRate ?>
// this php code placed before body of document
<?php
$NightlyRate = 0;
if ($RoomWanted == "Std2Queen")
{
$RoomWanted = "Standard w/2 queen size beds";
$NightlyRate = ((39 + (($NumAdults * 10) + ($NumChildren * 5))) * $NumNights);
}
if ($RoomWanted == "Std1King") {
$RoomWanted = "Standard w/1 king size bed";
$NightlyRate = ((49 + (($NumAdults * 10) + ($NumChildren * 5))) * $NumNights);
}
if ($RoomWanted == "Pool2Queen") {
$RoomWanted = "Pool side room 2/2 queens";
$NightlyRate = ((69 + (($NumAdults * 15) + ($NumChildren * 7))) * $NumNights);
}
if ($RoomWanted == "Pool1King") {
$RoomWanted = "Pool side room w/ king";
$NightlyRate = ((79 + (($NumAdults * 15) + ($NumChildren * 7))) * $NumNights);
}
if ($RoomWanted == "PoolLoft") {
$RoomWanted = "Pool Side Suite w/ loft";
$NightlyRate = ((102 + (($NumAdults * 20) + ($NumChildren * 10))) * $NumNights);
}
?>
Comments or questions?
PX is running PHP 5.2.11
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.