if(isset($_POST['Submit'])){ //catch the submit action and below declare avriables to catch the form data
$rm_disc = $_POST['room_disc'];
$rm_price=$_POST['room_price'];
$res_name = $_POST['res_name'];
//select datababase and update reservation table
$check_id = "SELECT * FROM reservation_info WHERE res_name = '$res_name'";
$result = mysql_query($check_id)
or die(mysql_error());
if ($result) { //test
echo "The Reservation Id $res_name already exists! Book in under another Reservation <a href='insert.php'> Retry </a><br>";
}
else{
$query = "INSERT INTO reservation_info(room_disc, room_price, res_name) VALUES ('$rm_disc', '$rm_price', '$res_name'
";
$result = mysql_query($store)
or die("Query failed!"
;
echo "The Reservation for $res_name, with a price of $ttl_price has been booked!";
}