使用当前日期验证Datepicker续订日期,并检查datepicker日期是否小于当前日期

时间:2017-03-03 06:46:59

标签: javascript php jquery html datepicker

我将使用当前日期验证已输入Renewaldate(DatePicker)。但我需要知道如何使用当前日期验证日期选择器续订日期我的要求是在{{1}时给出错误消息}日期小于当前日期。所以我有我的代码你可以请帮助提供解决方案请....提前谢谢...

member_add.php

DatePicker(Renewal)

memberaddajx.php

<?php
    include('assets/page_header.php');
?>           

<style>
   #display {
      color:red;
      font-size:12px;
      text-align:center;
   }
</style>    
<div class="container">
   <h1>ADDING THE MEMBER</h1>
   <form name="memadd" id="memadd" action="#" method="post">
      <table align='center'>
         <tr>
            <td> <label for="name">MemberName</label></td>
            <td ><input id="name" name="name"  type="text" /></td>                           
         </tr>
         <tr>
            <td> <label for="address">Address</label></td>
            <td ><textarea id="address"></textarea></td>
         </tr>
         <tr>
         <td>
            <label for="phno">phonenumber</label></td>
            <td ><input id="phno" name="phno" type="text" /></td>
         </tr>
         <tr>            
            <td><label for="renewaldate">RenewalDate</label></td>
            <td ><input id="renewaldate" name="renewaldate" type="text" /> </td>
         </tr>
         <tr>
            <td> <label for="maxborrowlimit">maxborrowlimit</label></td>
            <td ><input id="maxborrowlimit" name="maxborrowlimit" type="text" />  </td>
         </tr>
         <tr>
            <td> <label for="status">Status</label></td>
            <td ><select name="status" id="status">
<option value="ACTIVE">Active</option>
<option value="INACTIVE">Inactive</option>
</select></td>
         </tr>
      </table>
      <br>
      <input type="submit" name="click" value="add" id="click">
      <div id="display"> </div>
   </div>
</body>
</html>

的script.js

<?php
include('db.php');

//$renewaldate1 = date("Y-m-d H:i:s"); 
    $memname=mysql_real_escape_string($_POST['memname1']);
    $address=mysql_real_escape_string($_POST['address1']);
    $phonenumber=mysql_real_escape_string($_POST['phonenumber1']);
    $renewaldate=mysql_real_escape_string($_POST['renewaldate1']);


    $maxborrowlimit=mysql_real_escape_string($_POST['maxborrowlimit1']);
    $status=mysql_real_escape_string($_POST['status1']);
    //$renewaldate=$renewaldate1;

    $str="insert into member(name,address,phno,renewaldate,maxborrowlimit,status) values('$memname','$address',$phonenumber,'$renewaldate',$maxborrowlimit,'$status')";
    $query1=mysql_query($str,$dbconn);
    $display=$query1;
    $query2=mysql_query("select * from member");
    $display.= $query2;
    $result1=mysql_num_rows($query2);
        if($result1>0)
        {
        $display="Data Is Entered";
        }
        else
        {
        $display="Enter data";
        }
        echo  $display;

?>

警报(d);         //警报(dataString);

$(document).ready(function(){

    $( "#renewaldate" ).datepicker();
$("#click").click(function(e){
    //alert("click");
    console.log("div value"+$('#display').html());
    var currentdate=new date();
    var memname = $("#name").val();
    var address = $("#address").val();
    var phonenumber = $("#phno").val();
    var renewaldate = $("#renewaldate").val();
    var d=$.datepicker.formatDate("yy-mm-dd", new Date(renewaldate));
     alert(d);

    var maxborrowlimit = $("#maxborrowlimit").val();
    var status = $("#status").val();

    /*var email = $("#email").val();
    var password = $("#password").val();
    var contact = $("#contact").val();*/
    // Returns successful data submission message when the entered information is stored in database.
    //var dataString = 'name1='+ name + '&email1='+ email + '&password1='+ password + '&contact1='+ contact;
    var dataString='memname1='+memname+'&address1='+address+'&phonenumber1='+phonenumber+'&renewaldate1='+d+'&maxborrowlimit1='+maxborrowlimit+'&status1='+status;

0 个答案:

没有答案