-1
 <form action="actionMAppointment.php?stu_id=<?php echo $row_RecEdit['stu_id'] ?>" method="post">
        Time:
        <input type = "time" name="appointmentTime" id = "appointmentTime" />
        Date:
        <input type = "text" name="appointmentDate" id = "appointmentDate" />
        <input type = "submit" value="Make Appointment"/>
 </form>

actionMAppointment.php

$temp_id = $_GET['stu_id'];
$app_time    = $_POST['appointmentTime'];
$app_date    = $_POST['appointmentDate'];
$the_time = date('h:i A', strtotime($app_time));
mysql_query("UPDATE tbl_studentdetail SET stu_appointment = 1, appointment_time = $the_time, appointment_date = $app_date WHERE stu_id = $temp_id"); 
header("Location:appointment.php");
?>

Javascript for date

<style type="text/css">@import "js_pickdate/jquery.datepick.css";</style> 
<script type="text/javascript" src="js_pickdate/jquery.datepick.js">      </script>
<script type="text/javascript">
$(document).ready(function(){
    $('#appointmentDate').datepick({dateFormat: 'yy-mm-dd'});
});

For some reason it doesnt update the database at all. Can anyone help out Thanks!

Kenny
  • 3
  • 5
  • maybe because your installation doesn't support mysql_* functions – e4c5 Nov 30 '16 at 05:03
  • [check how to debug php](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php) and also be sure to stop using mysql_ immediately. if you use [parametized queries](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) you will not only get your insert working, but you will also avoid nasty sql injection. – WEBjuju Nov 30 '16 at 05:09
  • what are the type of appointment_time and appointment_date in mysql table? – Farzad Salimi Jazi Nov 30 '16 at 05:14
  • Check your current version of php.. If its above 5.* you need to change your code. As this code is deprecated now. Try changing it with advance php. – Rasika Nov 30 '16 at 05:18
  • Read up on using prepared statements with mysqli_* functions, or PDO. – flauntster Nov 30 '16 at 05:20

1 Answers1

0

May be you should change

$('#appointmentDate').datepick({dateFormat: 'yy-mm-dd'});

to

 $('#appointmentDate').datepick({dateFormat: 'yyyy-mm-dd'});
Rahul
  • 2,374
  • 2
  • 9
  • 17