Jump to content

Gotharious

Members
  • Posts

    159
  • Joined

  • Last visited

Everything posted by Gotharious

  1. Tried that, but still no changes at all check-in Date: 19 Sep 2011 check-out Date: 20 Sep 2011 Total Price: 0 Array ( [roomid] => [roomnum] => [hotelid] => 13 [datein] => 19 Sep 2011 [dateout] => 20 Sep 2011 [nrooms] => 2 [bookroom] => book )
  2. I tried booking 3 rooms and here is the result check-in Date: 18 Sep 2011 check-out Date: 19 Sep 2011 Total Price: 0 Array ( [roomid] => [roomnum] => [hotelid] => 13 [datein] => 18 Sep 2011 [dateout] => 19 Sep 2011 [nrooms] => 3 [bookroom] => book )
  3. Did that, but still nothing changed, I'm guessing that the $nrooms actually = 0 that's why when it's multiplied it equals 0, but I can't seem to find where is the error in all of this
  4. Hello All, I'm working on this project, and everything was great but the last part is screwed. The procedure is supposed to be, you choose a hotel ---> book a room ---> confirm the booking and enter your details --> get redirected to paypal Everything is fine except for the confirmation part, where you're supposed to confirm the room you booked, number of nights and so on, all the info is right, except for the booked room, where it should show you the price for the room multiplied by the number of night... instead it gives "Total Price = 0" So anyone can give me an example on how can I make it show the result of multiplying 2 inputs by a user? Variables are $nrooms $newdate Here is the code I wrote <?php $dbo = new DB(); $hotelObj = new hotelManager(); $hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid']; $roonsNo = $_POST['roomsNo']; $pr = $_POST['pr']; $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; $_SESSION['nrooms'] = $_POST['nrooms']; $roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; $roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; /********************** hotels ************************/ /******************************************************/ echo "<table width=95% border=0 align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> <tr><td valign=\"top\">"; echo "<table>"; echo "<tr>"; echo "<td valign=top>"; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='".$_SESSION['hotelID']."' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td>"; $result=$hotelObj->getHotelbyID($_SESSION['hotelID']); $row = mysql_fetch_array($result); echo "<table>"; echo "<tr><td valign=top><strong class=subtitle3>".$row['name']."</strong></td></tr>"; echo "<tr><td class=text valign=top>".$row['location']."</td></tr>"; echo "<tr><td class=text valign=top>check-in Date: ".$_SESSION['datein']."</td></tr>"; echo "<tr><td class=text valign=top>check-out Date: ".$_SESSION['dateout']."</td></tr>"; echo "<tr><td class=text valign=top>"; $newdate = $_SESSION['dateout'] - $_SESSION['datein']; $totalprice = $nrooms * $newdate; echo "</td></tr>"; echo "<tr><td class=text valign=top>Total Price: ".$totalprice."</td></tr>"; echo "</table>"; ?>
  5. Ok, I might have got to where is the problem now, but can't fix it when I book a room, and choose the dates, it gives me the right number of nights but zero rooms. I've tried different ways to make the number of rooms appear but still can't. The problem is that the variables for the rooms is not defined in the bookingmanager file, but in the hotels manager file, it gets the right data from the database. what I was to do now is when I book the room, it takes me to a confirmation page where it posts the data as HTML so it can take me to paypal website to make the payment
  6. Ok, here are the variables here is to choose the rooms </tr>"; while($row = @mysql_fetch_array($result)) { echo "<tr>"; echo "<td class=\"text\" align=center>".$row['room_type']."</td>"; echo "<td class=\"text\" align=center>".$row['price_per_day']."</td>"; echo "<td class=\"text\" align=center>".$row['people']." People</td>"; echo "<td class=\"text\" align=center>"; ?> <select name="nrooms" id="nrooms" onchange=" //alert('<?php echo $row['id'] ; ?>'); //alert(this.value); var exist = 0; if(roomids.length > 0) { for(var hh = 0;hh < roomids.length; hh++) { if(roomids[hh] == <?php echo $row['id'] ; ?>) { exist = 1; //alert(hh); roomnumar[hh] = this.value; } } if(exist == 0) { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } } else { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } document.bookingform.roomid.value = roomids; document.bookingform.roomnum.value = roomnumar; "> <option value=0> 0 </option> <?php for($i = 0; $i < $row['available_rooms']; $i++) { $nr = $i+1; $pr=$nr * $row['price_per_day']; echo "<option value=$nr>$nr ($pr\$)</option>"; } and here is the echo function <?php function echoPostedData() { $dbo = new DB(); $hotelObj = new hotelManager(); $hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid']; $pr = $_POST['pr']; $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; $roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; $roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; and here is where it should be posted <?php include("includes/bookinManager.php"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <th align="left" valign="top" class="formtable"> Booking Data </th> </tr> <tr> <td valign="top"> </td> </tr> <tr> <td valign="top"> <?php echoPostedData(); ?> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> </td> </tr> <tr> <td valign="top"><img src="images/spacer.gif" width="28" height="10" /></td> </tr> <tr> <td valign="top"> <?php if(isset($_POST['bookroom'])) {?>
  7. No, Actually I'm not getting any errors at all, just gives me 0 number of rooms booked but the right number of nights
  8. Hello there, I have a problem with this project I'm working on, everything is working fine except for one last thing. it goes as you go to the website, search for a city, choose a hotel from a list in that city, then book a room in that hotel, go to confirmation page then to paypal. everything is fine except after the booking when you go to the confirmation page, it shows correctly the number of nights you booked and everything, all except the rooms, it shows 0 rooms selected, and it doesn't give any price at all. here is the code <?php include("db.class.php"); class hotelManager { public function getHotel($where) { $where = isset($_POST['where']) ? $_POST['where'] : ""; $dbObj = new DB(); $where = $_POST['where']; $sql = "select * from hotels where city_id IN (select id from cities where name = '$where') or country_id IN (select id from countries where name = '$where')"; $result = mysql_query($sql); $arr = array(); echo "<table>"; while($row = mysql_fetch_array($result) or die(mysql_error())) { echo "<tr>"; echo "<td valign=\"top\" width=\"120px\">"; $rowid = $row['id']; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='$rowid'"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td valign=\"top\">"; echo "<table> <tr> <td valign=\"top\"> <a href=\"hotels.php?id=".$row['id']."\" class=\"titleslink\">".$row['name']."</a> </td> </tr> <tr> <td class=\"text\" valign=\"top\"> ".$row['location']." </td> </tr> </table>"; echo "</td>"; echo "</tr>"; } echo "</table>"; //return $arr; // array of arrays } /*************************** GET ONE HOTEL *****************************/ public function getHotelbyID($hotelID) { $dbObj = new DB(); $result = mysql_query("select * from hotels where id = '$hotelID'"); return $result; } public function HotelDatatabel($result) { $row = @mysql_fetch_array($result); echo "<table width=98%>"; echo "<tr>"; echo "<td valign=\"top\" width=\"120px\">"; $rowid = $row['id']; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='$rowid' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td valign=\"top\">"; echo "<table> <tr> <td valign=\"top\" class=\"searchtitle\"> ".$row['name']." </td> </tr> <tr> <td class=\"text\" valign=\"top\"> ".$row['location']." </td> </tr> <tr> <td> ".$row['details']." </td> </tr> <tr> <td> <a href=\"http://".$row['website']."\" class=\"link\">".$row['website']."</a> </td> </tr> </table>"; echo "</td>"; echo "</tr>"; echo "</table>"; } /************************************ GET ROOMS **************************************/ public function getHotelRooms($hotelID) { $result = mysql_query("select * from rooms where hotel_id = '$hotelID'"); echo "<form name='bookingform' id='bookingform' method='post' action='book.php'>"; echo "<input name=\"roomid\" id=\"roomid\" type=\"hidden\" />"; echo "<input name=\"roomnum\" id=\"roomnum\" type=\"hidden\" />"; echo "<input name=\"hotelid\" id=\"hotelid\" type=\"hidden\" value=\"$hotelID\"/>"; echo "<table width=80% >"; echo"<tr>"; echo "<td>Check-in date</td>"; echo "<td>"; echo "<input type=\"text\" name=\"datein\" class=\"date_input\" />"; echo "</td>"; echo "<td>Check-out date</td>"; echo "<td>"; echo "<input type=\"text\" name=\"dateout\" class=\"date_input\" />"; echo "</td>"; echo"</tr>"; echo "<table>"; echo "<table class=\"rooms\" width=100% cellspacing=\"1\" >"; echo "<tr> <th class=\"rooms\">Room Type</th> <th class=\"rooms\">Rate for night</th> <th class=\"rooms\">MAX</th> <th class=\"rooms\">Nr.rooms</th> <th class=\"rooms\">Book</th> </tr>"; while($row = @mysql_fetch_array($result)) { echo "<tr>"; echo "<td class=\"text\" align=center>".$row['room_type']."</td>"; echo "<td class=\"text\" align=center>".$row['price_per_day']."</td>"; echo "<td class=\"text\" align=center>".$row['people']." People</td>"; echo "<td class=\"text\" align=center>"; ?> <select name="nrooms" id="nrooms" onchange=" //alert('<?php echo $row['id'] ; ?>'); //alert(this.value); var exist = 0; if(roomids.length > 0) { for(var hh = 0;hh < roomids.length; hh++) { if(roomids[hh] == <?php echo $row['id'] ; ?>) { exist = 1; //alert(hh); roomnumar[hh] = this.value; } } if(exist == 0) { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } } else { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } document.bookingform.roomid.value = roomids; document.bookingform.roomnum.value = roomnumar; "> <option value=0> 0 </option> <?php for($i = 0; $i < $row['available_rooms']; $i++) { $nr = $i+1; $pr=$nr * $row['price_per_day']; echo "<option value=$nr>$nr ($pr\$)</option>"; } echo "</select> </td>"; echo "<td align=center> </td>"; echo "</tr>"; echo "<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>"; } echo "<tr class=\"rooms\"> <td colspan=\"4\"> </td> <td align=center><input type=\"submit\" value=\"book\" id=\"bookroom\" name=\"bookroom\"/></td> </tr>"; echo "</table>"; echo "</form>"; print_r($_SESSION['order']); $_SESSION['order']=0; unset($_SESSION['order']); } } ?> BookinManager.php <?php include("hotelsManager.php"); ?> <?php include("config.php"); ?> <?php include("textManager.php"); ?> <?php function echoPostedData() { $dbo = new DB(); $hotelObj = new hotelManager(); $hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid']; $pr = $_POST['pr']; $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; $roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; $roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; /********************** hotels ************************/ /******************************************************/ echo "<table width=95% border=0 align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> <tr><td valign=\"top\">"; echo "<table>"; echo "<tr>"; echo "<td valign=top>"; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='".$_SESSION['hotelID']."' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td>"; $result=$hotelObj->getHotelbyID($_SESSION['hotelID']); $row = mysql_fetch_array($result); echo "<table>"; echo "<tr><td valign=top><strong class=subtitle3>".$row['name']."</strong></td></tr>"; echo "<tr><td class=text valign=top>".$row['location']."</td></tr>"; echo "<tr><td class=text valign=top>check-in Date: ".$_SESSION['datein']."</td></tr>"; echo "<tr><td class=text valign=top>check-out Date: ".$_SESSION['dateout']."</td></tr>"; echo "<tr><td class=text valign=top>"; $newdate = $_SESSION['dateout'] - $_SESSION['datein']; $totalprice = array_sum($_SESSION['totalprice']) echo "</td></tr>"; echo "<tr><td class=text valign=top>Total Price: ".$totalprice."</td></tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td></tr></table>"; } function echoForm2() { ?> <form id="userDetails" name="userDetails" action="" method="post"> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td valign="top" class="subtitle3"><strong>Your Name</strong><br /> <input type="text" name="name" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Email address</strong><br /> <input type="text" name="email" size="50" /> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top" class="subtitle3"> <?php $roomsarray = explode(",",$_POST['roomid']); $roonsNo = explode(",",$_POST['roomnum']); for($i = 0;$i<count($roomsarray);$i++) { if($roonsNo[$i] > 1) { for($j = 0;$j<$roonsNo[$i];$j++) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']." #".($j+1)."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name </strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } else { if($roonsNo[$i] != 0) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name</strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } } ?> <hr> </td> </tr> <tr> <td align="right"> <input type="submit" name="submit" id="submit" value="Make the reservation" /> </td> </tr> </table> </form> <?php } ?> <?php include("includes/bookinManager.php"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <th align="left" valign="top" class="formtable"> Booking Data </th> </tr> <tr> <td valign="top"> </td> </tr> <tr> <td valign="top"> <?php echoPostedData(); ?> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> </td> </tr> <tr> <td valign="top"><img src="images/spacer.gif" width="28" height="10" /></td> </tr> <tr> <td valign="top"> <?php if(isset($_POST['bookroom'])) {?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <th align="left" valign="top" class="formtable"> Your Details </th> </tr> <tr> <td valign="top" > <form action="book.php" method="post" id="payPalForm"> <table width="60%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <td>First name :</td> <td><input type="text" name="first_name" /></td> </tr> <tr> <td>Last name :</td> <td><input type="text" name="last_name" /></td> </tr> <tr> <td>Email address :</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Full guest name :</td> <td><input type="text" name="full" /></td> </tr> <tr> <td>Address :</td> <td><INPUT type="text" NAME="address1" VALUE=""/></td> </tr> <tr> <td>Special Requests :</td> <td><input type="text" name="special" /></td> </tr> </table> </td> </tr> <tr> <td valign="top"> <?php //echoForm2(); ?> <input type="hidden" name="item_number" value="<?php echo $row['id']; ?>"> <input type="hidden" name="cmd" value="_ext-enter"> <input type="hidden" name="redirect_cmd" value="_xclick"> <input type="hidden" name="business" value="tarek_1305896294_biz@gotharious.com"> <input type="hidden" name="item_name" value="Standard Room: Dar El Masyaf Hotel : 2 nights : 9th, july, 2011"> <input type="hidden" name="currency_code" value="USD"> <INPUT TYPE="hidden" NAME="first_name" VALUE="Tarek"> <INPUT TYPE="hidden" NAME="last_name" VALUE="Sabrouty"> <INPUT TYPE="hidden" NAME="address1" VALUE="9th Popastes St."> <INPUT TYPE="hidden" NAME="address2" VALUE="Cleopatra Hamamat"> <INPUT TYPE="hidden" NAME="city" VALUE="Alexandria"> <INPUT TYPE="hidden" NAME="Country" VALUE="Egypt"> <INPUT TYPE="hidden" NAME="lc" VALUE="US"> <INPUT TYPE="hidden" NAME="email" VALUE="tarek@gotharious.com"> <INPUT TYPE="hidden" NAME="night_phone_a" VALUE="+20166005733"> <INPUT TYPE="hidden" NAME="amount" VALUE="100.00"> <?php $roomsarray = explode(",",$_POST['roomid']); $roonsNo = explode(",",$_POST['roomnum']); for($i = 0;$i<count($roomsarray);$i++) { if($roonsNo[$i] > 1) { for($j = 0;$j<$roonsNo[$i];$j++) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']." #".($j+1)."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name </strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } else { if($roonsNo[$i] != 0) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name</strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } } ?> <input type="submit" name="Submit" value="Submit"> </form> <tr> <td valign="top"> </td> </tr> </table> <?php } ?>
  9. Hello all, I'm having trouble with the following code, it's supposed to go like this, you search for a hotel, choose a room, then it takes you to confirmation page before the paypal, but the problem is, in the confirmation page, it shows everything right, the number of nights, the number of guests, all except the number of rooms, it always give me 0 rooms It's seperated into 3 files, hotelsmanager.php, bookingmanager.php, and book.php here are the codes while($row = @mysql_fetch_array($result)) { echo "<tr>"; echo "<td class=\"text\" align=center>".$row['room_type']."</td>"; echo "<td class=\"text\" align=center>".$row['price_per_day']."</td>"; echo "<td class=\"text\" align=center>".$row['people']." People</td>"; echo "<td class=\"text\" align=center>"; ?> <select name="nrooms" id="nrooms" onchange=" //alert('<?php echo $row['id'] ; ?>'); //alert(this.value); var exist = 0; if(roomids.length > 0) { for(var hh = 0;hh < roomids.length; hh++) { if(roomids[hh] == <?php echo $row['id'] ; ?>) { exist = 1; //alert(hh); roomnumar[hh] = this.value; } } if(exist == 0) { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } } else { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } document.bookingform.roomid.value = roomids; document.bookingform.roomnum.value = roomnumar; "> <option value=0> 0 </option> <?php for($i = 0; $i < $row['available_rooms']; $i++) { $nr = $i+1; $pr=$nr * $row['price_per_day']; echo "<option value=$nr>$nr ($pr\$)</option>"; } echo "</select> </td>"; echo "<td align=center> </td>"; echo "</tr>"; echo "<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>"; } echo "<tr class=\"rooms\"> <td colspan=\"4\"> </td> <td align=center><input type=\"submit\" value=\"book\" id=\"bookroom\" name=\"bookroom\"/></td> </tr>"; echo "</table>"; echo "</form>"; print_r($_SESSION['order']); $_SESSION['order']=0; unset($_SESSION['order']); } } ?> then booking info <?php include("hotelsManager.php"); ?> <?php include("config.php"); ?> <?php include("textManager.php"); ?> <?php function echoPostedData() { $dbo = new DB(); $hotelObj = new hotelManager(); $hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid']; $pr = $_POST['tp']; $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; $roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; $roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; Then the confirmation page is <?php echoPostedData(); ?> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> </td> </tr> <tr> <td valign="top"><img src="images/spacer.gif" width="28" height="10" /></td> </tr> <tr> <td valign="top"> <?php if(isset($_POST['bookroom'])) {?>
  10. Ok, great... Thank you a lot
  11. thanks, mate but how can i make it make calculations from my database and send it to paypal?
  12. Ok, I've got to make it redirect to paypal when you click on submit but the problem now, I want it to gather information from the website and take it to the paypal website like Room type, number of nights, Number of guests, Number of rooms, Total Price, Guest information etc. Here is the code I typed <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payPalForm"> <input type="hidden" name="item_number" value="01 - General Payment to My Domain"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="business" value="me@mydomain.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="return" value="http://mydomain.com/"> First Name: <input name="first_name" type="text" id="first_name" size="45"> Last Name: <input name="last_name" type="text" id="last_name" size="45"> E-mail: <input name="email" type="text" id="email" size="45"> Address 1: <input name="address1" type="text" id="address1" size="45"> Address 2: <input name="address2" type="text" id="address2" size="45"> City: <input name="city" type="text" id="city" size="45"> Country: <input name="countty" type="text" id="country" size="45"> Amount: <input name="amount" type="text" id="amount" size="45"> <br /><br /> <?php $roomsarray = explode(",",$_POST['roomid']); $roonsNo = explode(",",$_POST['roomnum']); for($i = 0;$i<count($roomsarray);$i++) { if($roonsNo[$i] > 1) { for($j = 0;$j<$roonsNo[$i];$j++) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']." #".($j+1)."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name </strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } else { if($roonsNo[$i] != 0) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name</strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } } ?> <input type="submit" name="Submit" value="Submit"> </form>
  13. Actually no, that's not the whole code, I'll try with the link you posted, thanks a lot for your help
  14. Hello there, I'm having a difficulty making the paypal integration with my online booking system, the developer who was making me this (who i can't find now) has set everything from searching to the point where you choose number of rooms you want in a hotel, then you click book now, it takes you to another page where you find information about your booking, and beneath it, you are supposed to enter you billing information, which doesn't really work what i want to do now, is instead of making the client enter his billing info on the website, it takes him to PayPal website where he pays there. I mean when you click, it gives you details of your order, and beneath it a form to enter your data. I want to add a "Make the Reservation" button that will redirect the client to the PayPal website where he makes the payment. I'm not sure which code I should post here, so I guess I should just post the code where the user gets the details of his order and enters his details. book.php <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <?php include("includes/bookinManager.php"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <th align="left" valign="top" class="formtable"> Booking Data </th> </tr> <tr> <td valign="top"> </td> </tr> <tr> <td valign="top"> <?php echoPostedData(); ?> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> </td> </tr> <tr> <td valign="top"><img src="images/spacer.gif" width="28" height="10" /></td> </tr> <tr> <td valign="top"> <?php if(isset($_POST['bookroom'])) {?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formtable"> <tr> <th align="left" valign="top" class="formtable"> Your Details </th> </tr> <tr> <td valign="top" > </td> </tr> <tr> <td valign="top"> <?php //echoForm2(); ?> <form id="userDetails" name="userDetails" action="" method="post"> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td valign="top" class="subtitle3"><strong>Your Name</strong><br /> <input type="text" name="name" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Email address</strong><br /> <input type="text" name="email" size="50" /> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top" class="subtitle3"> <?php $roomsarray = explode(",",$_POST['roomid']); $roonsNo = explode(",",$_POST['roomnum']); for($i = 0;$i<count($roomsarray);$i++) { if($roonsNo[$i] > 1) { for($j = 0;$j<$roonsNo[$i];$j++) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']." #".($j+1)."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name </strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } else { if($roonsNo[$i] != 0) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name</strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } } ?> </td> </tr> <tr> <td valign="top" class="subtitle3"><hr /></td> </tr> <tr> <td valign="top" class="subtitle3"> </td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Your Address</strong><br /> <input type="text" name="address" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>City</strong><br /> <input type="text" name="city" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>ZIP Code</strong><br /> <input type="text" name="zip" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Country</strong><br /> <input type="text" name="country" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Telephone</strong><br /> <input type="text" name="tel" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"> </td> </tr> <tr> <td valign="top" class="subtitle3"><table width="60%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><strong>Credit card type</strong><br /> <select name="cardtype"> <option value="american_express">American Express</option> <option value="visa">Visa</option> <option value="master_card">Master Card</option> <option value="diners_club">Dinerts Club</option> <option value="jcb">JCB</option> </select></td> <td valign="top"><strong>Credit card Number</strong><br /> <input type="text" accept="cardnum" /> </td> <td valign="top"> </td> </tr> <tr> <td valign="top"><strong>Card Holder's Name</strong><br /> <input type="text" name="holder"/></td> <td valign="top"><strong>Expiration date</strong><br /> <input type="text" name="exdate" class="date_input" /> </td> <td valign="top"><strong>CVC-code</strong><br /> <input type="text" name="cvc" size="7"/> </td> </tr> </table></td> </tr> <tr> <td valign="top" class="subtitle3"> </td> </tr> <tr> <td align="right"> <input type="submit" name="submit" id="submit" value="Make the reservation" /> </td> </tr> </table> </form> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> <?php } ?> bookinManager.php <?php include("hotelsManager.php"); ?> <?php include("config.php"); ?> <?php include("textManager.php"); ?> <?php function echoPostedData() { $dbo = new DB(); $hotelObj = new hotelManager(); /*$hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid'];*/ $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; //$roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; //$roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; /* NUM OF PEOPLE */ $numOfPeople = 0; for($i = 0;$i < count($_SESSION['nrooms']);$i++) { $result = mysql_query("select people from rooms where id = '".$_SESSION['roomsarray'][$i]."'"); $row = mysql_fetch_array($result); $numOfPeople += ($row[0] * $_SESSION['nrooms'][$i]);; } /********************** hotels ************************/ /******************************************************/ echo "<table width=95% border=0 align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> <tr><td valign=\"top\">"; echo "<table>"; echo "<tr>"; echo "<td valign=top>"; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='".$_SESSION['hotelID']."' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td>"; $result=$hotelObj->getHotelbyID($_SESSION['hotelID']); $row = mysql_fetch_array($result); echo "<table>"; echo "<tr><td valign=top><strong class=subtitle3>".$row['name']."</strong></td></tr>"; echo "<tr><td class=text valign=top>".$row['location']."</td></tr>"; echo "<tr><td class=text valign=top>check-in Date: ".$_SESSION['datein']."</td></tr>"; echo "<tr><td class=text valign=top>check-out Date: ".$_SESSION['dateout']."</td></tr>"; echo "<tr><td class=text valign=top>"; $newdate = $_SESSION['dateout'] - $_SESSION['datein']; echo @array_sum($_SESSION['nrooms'])." rooms, ".$numOfPeople." people, ".$newdate." nights"; echo "</td></tr></table>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td></tr></table>"; } function echoForm2() { ?> <form id="userDetails" name="userDetails" action="" method="post"> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td valign="top" class="subtitle3"><strong>Your Name</strong><br /> <input type="text" name="name" size="50" /></td> </tr> <tr> <td valign="top" class="subtitle3"><strong>Email address</strong><br /> <input type="text" name="email" size="50" /> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top" class="subtitle3"> <?php $roomsarray = explode(",",$_POST['roomid']); $roonsNo = explode(",",$_POST['roomnum']); for($i = 0;$i<count($roomsarray);$i++) { if($roonsNo[$i] > 1) { for($j = 0;$j<$roonsNo[$i];$j++) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']." #".($j+1)."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name </strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } else { if($roonsNo[$i] != 0) { echo "<div>"; $result = mysql_query("select * from rooms where id = '$roomsarray[$i]'"); $row = mysql_fetch_array($result); echo "<span class=subtitle3><strong>Room: </strong>".$row['room_type']."</span>"; echo "</div>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<span class=subtitle3><strong> Full guest name</strong></span>"; echo "<br />"; echo "<input type=text name=\"guest_name[]\" size=30/>"; echo "</td>"; echo "<td align=center> <span class=subtitle3><strong> Max people</strong></span> <br /> <span class=subtitle3>".$row['people']."guests</span> </td>"; echo "<td align=center> <span class=subtitle3><strong>Smoking</strong></span><br /> <select name='smoking'> <option value=\"\">...</option> <option value=\"yes\">Yes</option> <option value=\"no\">No</option> </select> </td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } } } ?> <hr> </td> </tr> <tr> <td align="right"> <input type="submit" name="submit" id="submit" value="Make the reservation" /> </td> </tr> </table> </form> <?php } ?> Please help me in this as I'm a total noob
  15. Yes, I'm using MySQL, and the ID is set to Auto Increment. I'm a total Noob in this I know, and I'm not really good in English, so I don't really get what you want me to do. I understand that you mean instead it search for the next available row, I should set it to just start with the next id right away as the id is set to auto increment, but I'm not really sure how to do it.
  16. Well that page which gives the error is Add Hotel page, where i should add data not view them i mean i click in the admin menu "list hotels, it lists around 100,000 hotel 5 hotels per page but when i click Add New Hotel it gives me this error. So actually i'm trying to add data not fetch results
  17. Ok, I removed the line i++; and still getting the same error, I can't increase the memory over 128mb as it's a shared server How can stop the infinite loop if there is one? the code was working just fine, and all other tabs is working great except for this table, it suddenly just keeps giving errors
  18. the memory allocation is 128 mb set in php.ini should I split it into multiple table? and please specify you mean the number of rows in the table or columns that are large?
  19. Hello everyone, I made this website using CakePHP, and it was working great, but then suddenly it started giving me this error Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 38 bytes) in /cake/libs/model/datasources/dbo/dbo_mysql.php on line 766 Here is the code that contains line number 766 /** * Fetches the next row from the current result set * * @return unknown */ function fetchResult() { if ($row = mysql_fetch_row($this->results)) { $resultRow = array(); $i = 0; foreach ($row as $index => $field) { list($table, $column) = $this->map[$index]; $resultRow[$table][$column] = $row[$index]; $i++; } return $resultRow; } else { return false; } } /**
  20. Hello Everyone, I figured out the problem, I accidently saved the file hotelManager.php in 3 folders in the website as well as on the main directory which was causing the tourble of the failed to open stream and also Fatal error: Cannot redeclare hotelManager::getHotel() in there were more than one file that has the same function and diferent files included in it
  21. Now after everything is solved, I'm getting this error Warning: include(config.php) [function.include]: failed to open stream: No such file or directory in hotelsManager.php on line 3 Warning: include() [function.include]: Failed opening 'config.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in hotelsManager.php on line 3 Fatal error: Class 'DB' not found in bookinManager.php on line 6
  22. Ok thank you, but one last thing this used to work before but now it gives me error when i try to book a room Fatal error: Cannot redeclare hotelManager::getHotel() in /home/www/gotharious.net/hotelsManager.php on line 47
  23. Mikesta, thanks a lot, you're amazing, and the best part is that you actually explain everything to me in a simple way, thanks a lot
  24. Thank you very much. Another thing if you could help me with, I have a slide show for images, that I want it to load images from a folder on the server where the folder name matches the id I mean say if the link is http://www.mydomain.com/hotels.php?id=204 I want the images located in folder 204 to be loaded on the slide show
  25. mikesta707, You're a genius, I've spent the last 3 weeks trying to figure this out, thank you, really I know this may sound odd, but could you recommend me a place where i can learn more about php and such, as I can't find neither courses nor books in Egypt :/ again, thanks alot
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.