You are missing the open and close brace for the
if
statement. But more importantly you are creating local variables in the
if(isset
, which are not visible to the following code. So it should be:
if(isset($_POST['submit'])){
if(!empty($_POST['usertype']) && !empty($_POST['userid']) && !empty($_POST['usertype']) && !empty($_POST['bookingdate']) && !empty($_POST['startingtime']) && !empty($_POST['facility']) && !empty($_POST['payment']) ) {
$usertype=$_POST['usertype'];
$userid=$_POST['userid'];
$bookingdate=$_POST['bookingdate'];
$startingtime=$_POST['startingtime'];
$facility=$_POST['facility'];
$payment=$_POST['payment'];
$sql = "INSERT INTO booking(B_UserType,B_UserID, B_Date,B_StartTime,B_Facility ,B_PaymentType) VALUES ('$usertype','$userid','$bookingdate','$startingtime','$facility','$payment')";
$run = mysqli_query($conn, $sql ) or die (mysqli_error());
if($run)
{
echo "Inserted";
}else
{
echo "Not inserted";
}
}
}