diff --git a/order/complete_order.php b/order/complete_order.php index 456f5863e0049499d900ec832c29881a8d9433b2..1f14004c9c7ed8fd3dc6a3382bbf473f6c26ca5f 100644 --- a/order/complete_order.php +++ b/order/complete_order.php @@ -31,6 +31,7 @@ $driverinfo_query = mysqli_query($con, "SELECT * FROM user JOIN (SELECT * FROM driver WHERE driver_id='" . $seldrv . "') AS drivert ON user_id = driver_id") or die(mysqli_error()); $driverinfo = mysqli_fetch_assoc($driverinfo_query); + echo $ppoint; $driver_username = $driverinfo['username']; $driver_name = $driverinfo['name']; ?> @@ -53,7 +54,7 @@ Complete Order </div> </div> - <form id="submit_cmplt_ordr" method="post"> + <form id="submit_cmplt_ordr" method="post" action="order_handler.php"> <div class="content" id="complete_order"> <h2> How was it? @@ -75,9 +76,14 @@ </div> <div> <textarea id="comment" name="comment" form="submit_cmplt_ordr"> - </textarea> </div> + + <input type="hidden" name="picking_point" value=<?php echo $ppoint ?>> + <input type="hidden" name="destination" value=<?php echo $dest ?>> + <input type="hidden" name="selected_driver" value=<?php echo $seldrv ?>> + <input type="hidden" name="customer" value=<?php echo $user_id ?>> + <input class="button green" type="submit" name="submit" value="Complete Order"> </div> </form> diff --git a/order/order_handler.php b/order/order_handler.php new file mode 100644 index 0000000000000000000000000000000000000000..04c1720eff7a4c5830fe7f9b353d4a97240b078b --- /dev/null +++ b/order/order_handler.php @@ -0,0 +1,20 @@ +<?php + include '../database/dbconnect.php'; + + $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 diff --git a/order/order_location_handler.php b/order/order_location_handler.php deleted file mode 100644 index cd3f447c34acb8562a6793210c84e0d6c9adf76d..0000000000000000000000000000000000000000 --- a/order/order_location_handler.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - include '../database/dbconnect.php'; - - if ($_SERVER["REQUEST_METHOD"] == "POST") { - - } -?> \ No newline at end of file