这是我的phpcode:
error_reporting(0);
$userLog = $_SESSION['user'];
mysql_select_db("dbwebsite") or die($connect_error);
$time = time();
$event = $_POST['eventname'];
$date = $_POST['datepicker'];
if($event == "" | $date = ""){
echo '<script type="text/javascript">alert("Type your Post First!");</script>';
header("Refresh:-0.0001;user_admin.php");
}
else{
$insert_error = "Your text could not be posted";
$insert = mysql_query("INSERT INTO events VALUES ('','$event','$date','$time')") or die ($insert_error);
header("Location:user_admin.php");
}
?>
这是我的日期选择器代码:
<script src="effects/calendar/jquery-1.9.1.js"></script>
<script src="effects/calendar/jquery-ui.js"></script>
<html>
<form action="update_event.php" name="event" id="event" method="post">
<p style="color:#000000">Event name:<input type="text" name="eventname" id="eventname" /></p>
<p style="color:#000000">Event Date:<input type="text" name="datepicker" id="datepicker" /></p>
<br /><input type="submit" name="btnevent" id="btnevent" value="Post event" />
</form>
</html>
0000-00-00 显示在我的数据库中,而不是我使用日期选择器选择的日期。