<div class="right_col" role="main">

    <div class="">

        <div class="row">

            <div class="col-md-12 col-sm-12 col-xs-12">

                <div class="x_panel">

					<div class="x_title">

						<h2>Reservation</h2>

						<div class="clearfix"></div>

					</div>

					<div class="x_content">

						<form class="form-horizontal form-label-left" method="post">
							
							<div class="form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12">Contact No</label>

								<div class="col-md-4 col-sm-3 col-xs-12">

									<input id="name" class="form-control col-md-7 col-xs-12" name="name" type="text">
								
							    </div>
							
							</div>

							<div class="form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12">Room No</label>

								<div class="col-md-4 col-sm-3 col-xs-12">

									<select class="form-control" name="roomId">

										<?php

											$result=mysqli_query($conn, "SELECT * FROM room") or die (mysql_error());

											while($row = mysqli_fetch_array($result))

											{

										?>

										<option value="<?php echo $row['r_id'];?>"><?php echo $row['r_no'];?></option>

										<?php

											}

										?>

									</select>

								</div>

							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="">Check In Date

								</label>

								<div class="col-md-4 col-sm-3 col-xs-12">

									<?php $today= date("Y-m-d");?>

									<input id="night" class="form-control col-md-4 col-xs-12" name="checkInDate" type="date" value="<?php echo $today;?>">

								</div>

							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="night">Nights <span class="required">*</span>

								</label>

								<div class="col-md-3 col-sm-3 col-xs-12">

									<input id="night" class="form-control col-md-3 col-xs-12" name="nightNo" type="number" value="1">

								</div>

							</div>
							
							<div class="form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12">Booking No</label>

								<div class="col-md-4 col-sm-3 col-xs-12">

									<input id="name" class="form-control col-md-7 col-xs-12" name="name" type="text">
								
							    </div>
							
							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="note">Note</span>

								</label>

								<div class="col-md-4 col-sm-3 col-xs-12">

									<textarea id="message" class="form-control" name="note"></textarea>

								</div>

							</div>

						<!--<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="reservationstatus">Status

								</label>

								<div class="col-md-6 col-sm-6 col-xs-12">

									<select class="form-control" name='reservationstatus'>

										<option>Choose option</option>

										<option value="0">New</option>

										<option value="1">Pending</option>

										<option value="2">Confirmed</option>

										<option value="3">Arrived</option>

										<option value="4">No Show</option>

										<option value="5">Checkout</option>

									</select>

								</div>

							</div>-->

							<div class="ln_solid"></div>

							<div class="form-group">

								<div class="col-md-6 col-md-offset-3">

									<button id="send" type="submit" class="btn btn-success" name="submit">Submit</button>

									<button type="reset" class="btn btn-primary" onclick="javascript:window.location='index.php?pagecontent=dashboard'">Cancel</button>

								</div>

							</div>

						</form>

					</div>

                </div>

            </div>

        </div>

    </div>

</div>



<?php 

	if(isset($_POST['submit']))

	{

		$guestId=$_POST['guestId'];

		$roomId=$_POST['roomId'];

		$checkInDate=$_POST['checkInDate'];

		$nightNo=$_POST['nightNo'];

		$platformId=$_POST['platformId'];

		$note=$_POST['note'];

	/*	$status=$_POST['reservationstatus'];*/

		

		//mysqli_query($conn, "INSERT INTO reservation (g_id, r_id, rv_ci_date, rv_night, rv_amount, rv_platform, rv_notes) VALUES ($guestId, $roomId, '$checkInDate', $nightNo, $amount, $platformId, '$note')") or die (mysql_error());

		mysqli_query($conn, "INSERT INTO reservation (g_id, r_id, rv_ci_date, rv_night, rv_platform, rv_notes) VALUES ($guestId, $roomId, '$checkInDate', $nightNo, $platformId, '$note')") or die (mysql_error());

		

		header('Location: index.php?pagecontent=reservation_list');  

	}



?>



