我想插入数据库 2 值,当前选择的时间然后计算的时间。所以基本上,像这样。“7:00AM - 10:00AM”这是我当前的代码。它将空白插入数据库。
$date = new DateTime($res_dur);
$date->add(new DateInterval('PT3H'));
$date->format('H:i:s');
$ndate = $_POST[$res_dur][$date];
$query = "INSERT INTO tbl_reservation(
res_no,cust_id,pack_type,plan_id,res_date,res_dur,
res_venue,pack_choice,date_app,add_ons,res_comm)
VALUES
('','{$cust_id}','{$pack_type}','{$plan_id}','{$res_date}','{$ndate}',
'{$res_venue}','{$pack_choice}',CURDATE(),'','')";
$result_set = mysql_query($query);
if ($result_set) {
echo "<script language=javascript>alert('You have been successfully registered!')</script>";
header("Location:home.php");