hi friends I have created dropdown dates while inserting user details into database.Here when i input one of the dropdown dates it dosen't get updated into database ,instead it gives default value 1970-01-01.Here i checked in my jquery the line var end_date=$("#end_date").val() when i give alert for this it dosen;t alert any value for end_date.Can u please point out where i have gone wrong, thank you in advance. chapter_subscription_search.php
<?php
include('db.php');
$start_date=date("Y-m-d");
?>
<html>
<head><title>Chapter Subscriptions</title>
<script src="js/jquery-1.12.4.js"></script>
  <script src="js/jquery-ui.js"></script>
  </head>
  <body>
  <header> <img src="images/ipoint.png" class="logo" /> USER REGISTRATION</header>
<div class="container">
<h1 style="text-align:center">ADDING THE CHAPTER SUBSCRIPTION DETAILS</h1>
<style>
#display {
color:red;
font-size:12px;
text-align:center;
}
.logo {
padding:5px;
float:left;
}
header {
background-color:#074e7c;
height:60px;
width:100%;
text-align:center;
color:white;
font-size:40px;
}
#wrap {
text-align:center;
}
</style>
<form name="chapter_subscriptions" id="chapter_subscriptions" action="#" method="post">
<table align='center' border='1'>
    <tr>
           <td> <label for="userid">UserId</label></td>
            <td ><input id="userid" name="userid"  type="text" /></td>
        </tr>
        <tr>
        <td> <label for="chapter_no">ChapterNumber</label></td>
        <td ><input id="chapter_no" name="chapter_no" type="text"/></td>
        </tr>
        <tr>
        <td> <label for="start_date">StartDate</label></td>
        <td ><input id="start_date" name="start_date" type="text"/></td>
        </tr>
        <tr>
        <td> <label for="end_date">EndDate</label></td>
        <td ><select name="end_date" id="end_date">
<option value=<?php $end_date = date('Y-m-d', strtotime("+3 months"));?>><?php echo $end_date; ?></option>
<option value=<?php $end_date = date('Y-m-d', strtotime("+6 months"));?>><?php echo $end_date;?> </option>
<option value=<?php $end_date = date('Y-m-d', strtotime("+9 months"));?>><?php echo $end_date;?> </option>
</select>
</td>
        </tr>
      <tr>
           <td> <label for="chap_lic">License</label></td>
           <td ><input id="chap_lic" name="chap_lic" type="text" />  </td>
        </tr>
        </table>
        <div id="wrap">
        <input type="submit" name="insert" id="insert" value="insert">
        <input type="submit" name="edit" id="edit" value="edit">
        </div>
        </form>
        </div>
<script type="text/javascript">
$(document).ready(function(){
    $("#insert").click(function(e){
        var userid = $("#userid").val();
        var chapter_no = $("#chapter_no").val();
        var start_date = $("#start_date ").val();
        var end_date = $("#end_date").val();
        var chap_lic = $("#chap_lic").val();
        var dataString='userid='+userid+'&chapter_no='+chapter_no+'&start_date='+start_date+'&end_date='+end_date+'&chap_lic='+chap_lic;
        alert(dataString);
        if(userid==""||chapter_no==""||chap_lic=="") {
            document.getElementById("display").innerHTML="Please Enter The Fields";
        } else {
            $.ajax({
                type: "POST",
                url: "chapter_subscription_insert.php",
                data: dataString,
                cache: false,
                success: function(result){
                    //alert("submitted"+result);
                    $('#display').html(result);
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert(xhr.status);
                    alert(thrownError);
                }
            });
            e.preventDefault(); 
        }
    });
});
</script>
            <div id="display">
            </div>
        </body>
        </html>
chapter_subscription_insert.php
<html>
<head><title>Insert</title></head>
<body>
<?php
include('db.php');
?>
<div id="display">
<?php
$userid=mysql_real_escape_string($_POST['userid']);
$chapter_no=mysql_real_escape_string($_POST['chapter_no']);
$start_date=mysql_real_escape_string($_POST['start_date']);
$start_date=date("Y-m-d");
$end_date1 = mysql_real_escape_string(($_POST['end_date']));
$end_date=date("Y-m-d",strtotime($end_date1));
//echo $end_date;
$chap_lic=mysql_real_escape_string($_POST['chap_lic']);
$str="insert into chapter_subscriptions(userId,chapter_no,start_date,end_date,chap_lic) values($userid,$chapter_no,'$start_date','$end_date','$chap_lic')";
$query=mysql_query($str);
if($query)
{
    $display="Success";
} else {
    $display="Failed";
}
echo $display;
?>
</div>
</body>
</html>
 
     
     
    