hi i have a problem I have a date field first page and second page also one is start date and second page date name is end date i enter the start date in first page and i should not enter end date less than start date, How should i write the code for this to check whether end date should not be less than start date please help me with the code how to do it? please help me
thanks in advance
Be more specific plz, maybe an example ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script language="javascript" src="date-picker.js"></script> </head> <body> <form name="form1" method="post" action="test2.php"> <input type="text" name="registration_date" readonly value="<?php echo $_POST['registration_date']; ?>"onblur="this.style.backgroundColor='#ffffff'" onfocus="this.style.backgroundColor='#FFFFB2'"><a href="javascript:show_calendar('form1.registration_date');" onmouseover="window.status='Pick your Primary Registration date ...';return true;" onmouseout="window.status='';return true;" title="Pick your Primary Registration date"><img src="images/cal.gif" alt="Popup Calendar" name="calendaricon" width="16" height="16" border="0" id="calendaricon"></a></td> <?php $cn=mysql_connect("localhost","root","") or die("cannot connect"); $db=mysql_select_db("testing"); $tdate=$_POST['registration_date']; $qry=mysql_query("insert into testdatatable values($tdate)"); ?> <input type="submit" value="submit"> </form> </body> </html> //THE above one is test1.php //the following is test2.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script language="javascript" src="date-picker.js"></script> </head> <body> <form name="form1" method="post" action="test1.php"> <input type="text" name="registration_date" readonly value="<?php echo $_POST['registration_date']; ?>"onblur="this.style.backgroundColor='#ffffff'" onfocus="this.style.backgroundColor='#FFFFB2'"><a href="javascript:show_calendar('form1.registration_date');" onmouseover="window.status='Pick your Primary Registration date ...';return true;" onmouseout="window.status='';return true;" title="Pick your Primary Registration date"><img src="images/cal.gif" alt="Popup Calendar" name="calendaricon" width="16" height="16" border="0" id="calendaricon"></a></td> <?php $cn=mysql_connect("localhost","root","") or die("cannot connect"); $db=mysql_select_db("testing"); $tdate1=$_POST['registration_date']; //here i must enter the second date where it should be greater than first page $tdate $qry=mysql_query("insert into testdatatable values($tdate1)"); ?> <input type="submit" value="submit"> </form> </body> </html>
Aha, I think I understand what u want to do ...
U want to check if one date is bigger then another date?
For this u can use unix timestamp.
mktime() <-- for php
UNIXT_TIMESTAMP() <-- for mysql
hi bogu, thanks for u r reply i checked mktime function but not that i require I require when i enter date1 in the test1.php and i will insert the date in the table and my registration form continues to second page where there is another date2 field will be there, the date2 field what i enter in test2.php page must check after the data is entered(i mean the date is entered and submit to insert the data into the table ) should display if the test2.php date is lesser than test1.php date1 then it should throw an error and asking me to enter the date2
I need that code