Jump to content

Reserve/Booking Script


Guest Knuckles
 Share

Recommended Posts

Guest Knuckles

Hello,I need to make a booking system for an assignment and i got the whole thing done, except for the reserve/booking script. I need it be able to book one out of 3 house`s. when its booking for 3-3-10 till 10-3-10 it cant be booked again on that date and within but it may book one of other house`s.Can u help me with this please? (Sorry if its kinda bad translated, cause script was in other language)Script:

<?phpsession_start();include("config.php");if (!empty($_POST)){	$arrivalday = mysql_real_escape_string($_POST["arrivalday"]);$arrivalmonth = mysql_real_escape_string($_POST["arrivalmonth"]);$arrivalyear = mysql_real_escape_string($_POST["arrivalyear"]);$leavingday = mysql_real_escape_string($_POST["leavingday"]);$leavingmonth = mysql_real_escape_string($_POST["leavingmonth"]);$leavingyear = mysql_real_escape_string($_POST["leavingyear"]);$house = mysql_real_escape_string($_POST["house"]);$query = "SELECT * FROM reserve WHERE house >='". $house ."' AND arrivalday >='". $arrivalday ."' AND arrivalmonth >= '". $arrivalmonth ."' AND arrivalyear >= '". $arrivalyear ."' AND leavingday <= '". $leavingday ."' AND leavingmonth <= '". $leavingmonth ."' AND leavingyear <= '". $leavingyear ."'";$check = mysql_query($query) or die ("FOUT: " . mysql_error().$query);while ($row = mysql_fetch_array($check)){$check2[] = $row;}			   if( count($check2) == 0 ) {		$reserve = "INSERT INTO reserve(customernumber, customername, house, arrivalday, arrivalmonth, arrivalyear, leavingday, leavingmonth, leavingyear)";		$reserve .= "VALUES ('";		$reserve .= $_POST["customernumber"] ."', '";		$reserve .= $_POST["customername"] ."', '";		$reserve .= $_POST["house"] ."', '";		$reserve .= $_POST["arrivalday"] ."', '";		$reserve .= $_POST["arrivalmonth"] ."', '";		$reserve .= $_POST["arrivalyear"] ."', '";		$reserve .= $_POST["leavingday"] ."', '";		$reserve .= $_POST["leavingmonth"] ."', '";		$reserve .= $_POST["leavingyear"] ."');";		$verzenden = mysql_query ($reserve) or die(mysql_error());				$customernumber = $_POST["customernumber"];		$customername = $_POST["customername"];		$house = $_POST["house"];		$arrivalday = $_POST["arrivalday"];		$arrivalmonth = $_POST["arrivalmonth"];		$arrivalyear = $_POST["arrivalyear"];		$leavingday = $_POST["leavingday"];		$leavingmonth = $_POST["leavingmonth"];		$leavingyear = $_POST["leavingyear"];				$_SESSION["customernumber"];		$_SESSION["customername"];		$_SESSION["house"];		$_SESSION["arrivalday"];		$_SESSION["arrivalmonth"];		$_SESSION["arrivalyear"];		$_SESSION["leavingday"];		$_SESSION["leavingmonth"];		$_SESSION["leavingyear"];  	} else {	exit;	}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en"><head>	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />	<title>Vacation house rental</title><style type="text/css">#popupbox{  margin: 0;   margin-left: 40%;   margin-right: 40%;   margin-top: 50px;   padding-top: 10px;   width: 20%;   height: 150px;   position: absolute;  background: #22343A;   border: solid #000000 2px;   z-index: 9;  font-family: arial;   visibility: hidden;    }  </style>  <script language="JavaScript" type="text/javascript">  function login(showhide){	if(showhide == "show"){		document.getElementById('popupbox').style.visibility="visible";	}else if(showhide == "hide"){		document.getElementById('popupbox').style.visibility="hidden";	}  }  </script>	<script type="text/javascript" src="script.js"></script>	<link rel="stylesheet" href="style.css" type="text/css" media="screen" />	<!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->	<!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]--></head><body><div id="popupbox"><form name="login" action="login2.php" method="post"><center>username:</center><center><input name="username" type="text"  size="30" maxlength="40"></center><center>password:</center><center><input name="password" type="password" size="30" maxlength="8"></center><center><input type="Submit" name="Submit" value="Login" /></center></form><br /><center><a href="java script:login('hide');">Sluiten</a></center> </div><div id="art-main">		<div class="art-Sheet">			<div class="art-Sheet-tl"></div>			<div class="art-Sheet-tr"></div>			<div class="art-Sheet-bl"></div>			<div class="art-Sheet-br"></div>			<div class="art-Sheet-tc"></div>			<div class="art-Sheet-bc"></div>			<div class="art-Sheet-cl"></div>			<div class="art-Sheet-cr"></div>			<div class="art-Sheet-cc"></div>			<div class="art-Sheet-body">				<div class="art-Header">					<div class="art-Header-png"></div>					<div class="art-Header-jpeg"></div>					<div class="art-Logo">						<h1 id="name-text" class="art-Logo-name"><a href="#">Vacation house rental</a></h1>					</div>				</div>				<div class="art-nav">					<div class="l"></div>					<div class="r"></div>					<div class="art-nav-center">			<ul class="art-menu">						<li>							<a href="index2.php" class=" active"><span class="l"></span><span class="r"></span><span class="t">Home</span></a>						</li>						<li>							<a href="vacationhouse.php"><span class="l"></span><span class="r"></span><span class="t">vacationhouse</span></a>						</li>						<li>							<a href="reserve.php"><span class="l"></span><span class="r"></span><span class="t">reserve</span></a>						</li>						<?phpif (!isset($_SESSION["username"])){					echo ("<li><a href=register.php><span class=l></span><span class=r></span><span class=t>Register</span></a></li>");			echo "<li><a href=java script:login('show')><span class=l></span><span class=r></span><span class=t>Login</span></a></li>";}else{			echo ("<li><a href=Profile.php><span class=l></span><span class=r></span><span class=t>Profile</span></a></li>");			echo ("<li><a href=logout.php><span class=l></span><span class=r></span><span class=t>Logout</span></a></li>");}		?>												<li>							<a href="admin/admin.php"><span class="l"></span><span class="r"></span><span class="t">Admin Panel</span></a>						</li>					</ul>					</div>				</div>		  					<div class="art-content">						<div class="art-Post">							<div class="art-Post-tl"></div>							<div class="art-Post-tr"></div>							<div class="art-Post-bl"></div>							<div class="art-Post-br"></div>							<div class="art-Post-tc"></div>							<div class="art-Post-bc"></div>							<div class="art-Post-cl"></div>							<div class="art-Post-cr"></div>							<div class="art-Post-cc"></div>							<div class="art-Post-body">						<div class="art-Post-inner">										<div class="art-PostMetadataHeader">											<h2 class="art-PostHeader">												Welcome											</h2>										</div>										<div class="art-PostContent">							<form name="form1" method="post" action="<?php echo($_SERVER["PHP_SELF"]);?>">  <center>  <table width="350" height="150" border="0">	<tr>	  <td width="53">house:</td>	  <td width="260"><select name="house">		<option value="house 1">house 1</option>		<option value="house 2">house 2</option>		<option value="house 3">house 3</option>	  </select></td>	</tr>	<tr>	  <td>customername:</td>	  <?php $result = mysql_query("SELECT * FROM login ORDER BY username");while ($rij = mysql_fetch_array ($result)){	echo ("<td> ". $rij['firstname'] . " " . $rij['lastname'] ." </td>" .	"</td>\n ");	}?>	</tr>	<tr>	  <td>Aankomst Datum:</td>	  <td><select name="arrivalday">		<option value="01">01</option>1		<option value="02">02</option>		<option value="03">03</option>		<option value="04">04</option>		<option value="05">05</option>		<option value="06">06</option>		<option value="07">07</option>		<option value="08">08</option>		<option value="09">09</option>		<option value="10">10</option>		<option value="11">11</option>		<option value="12">12</option>		<option value="13">13</option>		<option value="14">14</option>		<option value="15">15</option>		<option value="16">16</option>		<option value="17">17</option>		<option value="18">18</option>		<option value="19">19</option>		<option value="20">20</option>		<option value="21">21</option>		<option value="22">22</option>		<option value="23">23</option>		<option value="24">24</option>		<option value="25">25</option>		<option value="26">26</option>		<option value="27">27</option>		<option value="28">28</option>		<option value="29">29</option>		<option value="30">30</option>		<option value="31">31</option>	  </select> 		- 		<select name="arrivalmonth">		  <option value="01">01</option>		  <option value="02">02</option>		  <option value="03">03</option>		  <option value="04">04</option>		  <option value="05">05</option>		  <option value="06">06</option>		  <option value="07">07</option>		  <option value="08">08</option>		  <option value="09">09</option>		  <option value="10">10</option>		  <option value="11">11</option>		  <option value="12">12</option>		</select> 		- 		<select name="arrivalyear">		  <option value="2010">2010</option>		  <option value="2011">2011</option>		  <option value="2012">2012</option>		  <option value="2013">2013</option>		  <option value="2014">2014</option>		  <option value="2015">2015</option>		  <option value="2016">2016</option>		  <option value="2017">2017</option>		  <option value="2018">2018</option>		  <option value="2019">2019</option>		  <option value="2020">2020</option>		  <option value="2021">2021</option>		  <option value="2022">2022</option>		  <option value="2023">2023</option>		  <option value="2024">2024</option>		  <option value="2025">2025</option>		</select></td>	</tr>	<tr>	  <td>Vertrek datum:</td>	  <td><select name="leavingday">		<option value="01">01</option>		<option value="02">02</option>		<option value="03">03</option>		<option value="04">04</option>		<option value="05">05</option>		<option value="06">06</option>		<option value="07">07</option>		<option value="08">08</option>		<option value="09">09</option>		<option value="10">10</option>		<option value="11">11</option>		<option value="12">12</option>		<option value="13">13</option>		<option value="14">14</option>		<option value="15">15</option>		<option value="16">16</option>		<option value="17">17</option>		<option value="18">18</option>		<option value="19">19</option>		<option value="20">20</option>		<option value="21">21</option>		<option value="22">22</option>		<option value="23">23</option>		<option value="24">24</option>		<option value="25">25</option>		<option value="26">26</option>		<option value="27">27</option>		<option value="28">28</option>		<option value="29">29</option>		<option value="30">30</option>		<option value="31">31</option>	  </select>			  - 		<select name="leavingmonth">		  <option value="01">01</option>		  <option value="02">02</option>		  <option value="03">03</option>		  <option value="04">04</option>		  <option value="05">05</option>		  <option value="06">06</option>		  <option value="07">07</option>		  <option value="08">08</option>		  <option value="09">09</option>		  <option value="10">10</option>		  <option value="11">11</option>		  <option value="12">12</option>		</select>				- 		<select name="leavingyear">		  <option value="2010">2010</option>		  <option value="2011">2011</option>		  <option value="2012">2012</option>		  <option value="2013">2013</option>		  <option value="2014">2014</option>		  <option value="2015">2015</option>		  <option value="2016">2016</option>		  <option value="2017">2017</option>		  <option value="2018">2018</option>		  <option value="2019">2019</option>		  <option value="2020">2020</option>		  <option value="2021">2021</option>		  <option value="2022">2022</option>		  <option value="2023">2023</option>		  <option value="2024">2024</option>		  <option value="2025">2025</option>		</select> </td>	</tr>  </table>  <p> </p>	<input type="submit" name="submit" value="reserve">	<input name="reset" type="reset" value="Empty">	  </center></form>																						</div>										<div class="cleared"></div>						</div>														<div class="cleared"></div>							</div>						</div>					</div>				</div>				<div class="cleared"></div><div class="art-Footer">					<div class="art-Footer-inner">						<a href="#" class="art-rss-tag-icon" title="RSS"></a>						<div class="art-Footer-text">							<p></p>						</div>					</div>					<div class="art-Footer-background"></div>				</div>				<div class="cleared"></div>			</div>		</div>		<div class="cleared"></div>	</div>	</body></html>

Edited by Knuckles
Link to comment
Share on other sites

you're working on a booking system, and you got it all done, except the reserve/booking script? uhh.... :)what do you think should happen (logically)? Write it down on paper and see if it makes sense with some example tests you throw at it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...