<?php
session_start();

if(isset($_POST['age']) &&isset($_POST['amount']) && isset($_POST['pstatus']) && isset($_POST['octype']) && isset($_POST['paytype']) && isset($_POST['clerk']) && isset($_POST['departure']) && isset($_POST['arrival']) && isset($_POST['dai']) && isset($_POST['bodmonth']) && isset($_POST['bodyear']) && isset($_POST['no_night']) && isset($_POST['no_guest'])  && isset($_POST['hotelid']) && isset($_POST['phoneno']) && isset($_POST['nation'])   && isset($_POST['fname']) && isset($_POST['mname']) && isset($_POST['lname']) && isset($_POST['rono'])){

$nt=$_POST['nation'];$hid=$_POST['hotelid'];$cr=$_POST['carreg']; $pay=$_POST['paytype'];$pst=$_POST['pstatus'];

$fn=$_POST['fname'];   $mn=$_POST['mname'];  $ln=$_POST['lname'];$po =$_POST['pobox'];$rm=$_POST['rono'];$am=$_POST['amount'];

$em=$_POST['email'];  $pcode =$_POST['postcode']; $pro=$_POST['profesion'];   $phn =$_POST['phoneno'];$oct=$_POST['octype'];

$cle =$_POST['clerk']; $depart =$_POST['departure'];  $arriv =$_POST['arrival']; $day =$_POST['dai'];  $bm =$_POST['bodmonth'];

 $by =$_POST['bodyear'];  $nn =$_POST['no_night']; $ng =$_POST['no_guest'];$age=$_POST['age'];

$pob="P.O.Box ".$po;

$cust=Date("Ymdhis");

$date=$by."-".$bm."-".$day;

$rec=Date("Ymdhis");
$dat= Date("Y-m-d");

$ocid= Date("his");

$int= Date("h:i:s");

include("buda_connect.php");

mysql_query("insert into customer(cust_id, fname, mname, lname,hotel_id,room_no,email, profession,address,post_code,nationality) 

values ('$cust','$fn','$mn','$ln','$hid','$rm','$em','$pro','$pob','$pcode','$nt')") or die("Error :".mysql_error());


mysql_query("insert into recept(recept_no, hotel_id, cust_id, room_id, arrived_on,check_in_time, arivedf,departure_on, departure_to,no_of_night,nofguest,occupation_type,clerksign,pay_type,cash_amount,Age,car_reg,p_status)

 values('$rec','$hid','$cust','$rm','$dat','$int','$arriv','$date','$depart','$nn','$ng','$oct','$cle','$pay','$am','$age','$cr','$pst')") or die("Error 4: ".mysql_error());


mysql_query("insert into phone_number(cust_id,phno) values('$cust','$phn')") or die("Error 5:".mysql_error());


 

mysql_query("update room set rstatus='Occupied' where room_no='$rm'") or die("Error: 6".mysql_error());

//include("receit_form.php");

}
else{
echo "No value posted";

}
?>