HOW TO keep dates chosen!

Talk and help info about common issues

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

kallesoe
Senior
Senior
Posts: 28
Joined: May 23rd, '09, 21:06

HOW TO keep dates chosen!

Postby kallesoe » Apr 2nd, '11, 13:05

Hello


I wanted to keep the dates the user has chosen, so I made a change in the file Rooms.Class.php

In the start of the function DrawSearchAvailabilityBlock() I added these lines

//Set Sessions to remember dates
if (isset($_POST['checkin_monthday'])) {
$_SESSION['checkin_monthday']=$_POST['checkin_monthday'];
}
else {
if (isset($_SESSION['checkin_monthday'])) {
$_POST['checkin_monthday']=$_SESSION['checkin_monthday'];
}
}

if (isset($_POST['checkin_year_month'])) {
$_SESSION['checkin_year_month']=$_POST['checkin_year_month'];
}
else {
if (isset($_SESSION['checkin_year_month'])) {
$_POST['checkin_year_month']=$_SESSION['checkin_year_month'];
}
}

if (isset($_POST['checkout_monthday'])) {
$_SESSION['checkout_monthday']=$_POST['checkout_monthday'];
}
else {
if (isset($_SESSION['checkout_monthday'])) {
$_POST['checkout_monthday']=$_SESSION['checkout_monthday'];
}
}

if (isset($_POST['checkout_year_month'])) {
$_SESSION['checkout_year_month']=$_POST['checkout_year_month'];
}
else {
if (isset($_SESSION['checkout_year_month'])) {
$_POST['checkout_year_month']=$_SESSION['checkout_year_month'];
}
}


In index.php in line 57 I added
session_start();

It seems to work.

I know you can make the code shorter by using shorthanded PHP.
- but maybe you should add this in the next version - I see this in other booking-system.

best regards,
Bjarne

Return to “ApPHP Hotel Site {HOW TO}”