From bf7f06898844b588df042a2fd284d06479634ef5 Mon Sep 17 00:00:00 2001 From: ayamberkakienam <zackhardyz@gmail.com> Date: Sat, 7 Oct 2017 15:11:43 +0700 Subject: [PATCH] Create handler to insert order data to db --- order/order_handler.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/order/order_handler.php b/order/order_handler.php index cd3f447c..04c1720e 100644 --- a/order/order_handler.php +++ b/order/order_handler.php @@ -1,7 +1,20 @@ <?php include '../database/dbconnect.php'; - if ($_SERVER["REQUEST_METHOD"] == "POST") { - - } + $cust_id = $_POST['customer']; + $driver_id = $_POST['selected_driver']; + $pick_city = $_POST['picking_point']; + $dest_city = $_POST['destination']; + $score = $_POST['rating']; + $comment = $_POST['comment']; + $date = date("Y-m-d") + + $insert_order_query = mysqli_query($con, " + INSERT INTO order (dest_city, pick_city, score, comment, driver_id, cust_id, date) + VALUES ($dest_city, $pick_city, $score, $comment, $driver_id, $cust_id) + ") or die(mysqli_error()); + + header("Location : order.php") + + mysqli_close($con); ?> \ No newline at end of file -- GitLab