diff --git a/order/order_handler.php b/order/order_handler.php index b676fbd7718efb45aeaf011dfcc7c92292d626e8..becc1c26ea1f893e4a4d23b5f0ad55e47f14f32e 100644 --- a/order/order_handler.php +++ b/order/order_handler.php @@ -13,6 +13,11 @@ 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."', '".$date."') ") or die(mysqli_error($con)); + $modify1_driver_query = mysqli_query($con," + UPDATE `driver` + SET votes = votes + 1, total_score = total_score + $score + WHERE driver_id = '$driver_id' + ") or die(mysqli_error($con)); mysqli_close($con); diff --git a/order/select_driver.php b/order/select_driver.php index db891adb157f1f7b76bf4a408343747bf0027e11..85e7d94bda42336190e9333c0b5301cb2dc9d34f 100644 --- a/order/select_driver.php +++ b/order/select_driver.php @@ -154,7 +154,6 @@ <div id="driver_table_container"> <form method="post" id="submit_select_drv" action=<?php echo "complete_order.php?id=".$user_id ?>> - <?php echo $ppoint . $dest; ?> <div class="content" id="select_driver"> <div id="preferred_driver"> diff --git a/order/select_location.php b/order/select_location.php index 469b4d12b6c2883086914a27b4c3509dcc6af654..903a3259d5a37ed68aa17b977023f0f4663b2d9c 100644 --- a/order/select_location.php +++ b/order/select_location.php @@ -65,25 +65,43 @@ </div> - <form method="post" action=<?php echo "select_driver.php?id=" . $user_id;?>> + <form method="post" id="submit_select_loc" name="submit_select_loc" action=<?php echo "select_driver.php?id=" . $user_id;?> onsubmit="return checkValidity();"> <div class="content" id="select_destination"> <div> <span class="loc_form_label">Picking point</span> - <input type="text" name="picking_point"> + <input type="text" name="picking_point" id="picking_point"> </div> <div> <span class="loc_form_label">Destination</span> - <input type="text" name="destination"> + <input type="text" name="destination" id="destination"> </div> <div> <span class="loc_form_label">Preferred driver</span> <input type="text" name="preferred_driver" placeholder="(optional)"> </div> - <input type="submit" name="submit_select_loc" class="button green" id="loc_button" value="Next"> + <div class="button green" onclick="checkValidity();"> + Next + </div> </div> </form> </div> </div> </body> +<script type="text/javascript"> + window.alert('weo'); + + function checkValidity() { + var form = document.getElementById('submit_select_loc'); + var PPfield = document.getElementById('picking_point'); + var Dfield = document.getElementById('destination'); + var isValid = (PPfield.value == "" || Dfield.value == "") ? false : true; + + if (!isValid) { + window.alert("Please fill both picking point and destination fields"); + } else { + form.submit(); + } + } + </script> </html>