 <?php
include("config2.php");

$date = $conn->real_escape_string($_POST['date']);
$room = $conn->real_escape_string($_POST['room']);

if($room!=""){
if($date!=""){

$input = "$date"; // starting date in d-m-Y format
 
list($day, $month, $year) = explode("-", $input);
$start = $year . "-" . $month . "-" . $day;
 
 //---------------------
$input = "$start";
$today=date("Y-m-d");

if($start<$today){$start=$today;}
//---------------------
 

for ($i = 0; $i < 10; $i++) {
    $nextDate = date("d-m-Y", strtotime("+$i days", strtotime($start)));
	$nextDate2 = date("Y-m-d", strtotime("+$i days", strtotime($start)));
	
	
$sql = "SELECT * FROM bookings WHERE room_no='$room' and check_in='$nextDate2' limit 1";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
 ?><div class="date-box<?php if($row!=""){echo $row[status];}?>"><?php 
	
	if($row!=""){echo $row[status].'&nbsp';}
    echo $nextDate;
	?></div><?php 
}


 
   
}else{echo 'Please Select Date';}
	}else{echo 'Please Select Room';}
?> 