new_php85 Posted October 13, 2008 Share Posted October 13, 2008 i...i have some problem to control entry date.i want, user cannot add claim when the "date_me" have over limit which the date is not valid anymore. for example date_me only can accept date in october but after october the date is not valid.currently i only use like this.but i think there is some better code. this is is my example coding <?php session_start(); include 'includes/db_connect.php'; include 'includes/css.php'; if (isset($_POST['bttnAdd'])) { $me_id = $_POST['me_id']; $staff_id = $_POST['staff_id']; $date_me = $_POST['date_me']; $particular = $_POST['particular']; $bill_me = $_POST['bill_me']; $ammount_me = $_POST['ammount_me']; $data = 1; $query = "INSERT INTO me(staff_id, date_me, particular, bill_me, ammount_me) VALUES('$staff_id','$date_me','$particular','$bill_me','$ammount_me') WHERE date_me != '2008-10-28'"; mysql_query($query) or die('Query failed. ' . mysql_error()); echo "<script language='JavaScript'> alert('The record is successfully added');</script>"; echo "<script language='JavaScript'> window.location ='me.php';</script>"; } ?> <form name="me" action='me.php' method = "post" onSubmit="return validateForm(this,arrFormValidation);"> <table width="678" align="center"> <tr> <td height="20" colspan="2" class="tajukkecil"><b>Miscellaneous Expense</b></td> </tr> <tr> <td width="85">Date</td> <td width="581">: <input class="special" type="text" name = "date_me" maxlength = "10" size = "16"><a href="Javascript:ShowCalendar('document.me.date_me',1900,2030,'dd-mm-yyyy');"><img src="pic/ew_calendar.gif"></a> <input class="special" type = "hidden" name = "staff_id" value = "<?php echo $_SESSION['staff_id']?>" Readonly></td> </tr> <tr> <td width="85">Particular</td> <td width="581">: <input class="special" name = "particular" maxlength = "150" size = "46"></td> </tr> <tr> <td width="85">Bill No.</td> <td width="581">: <input class="special" name = "bill_me" maxlength = "15" size = "16"></td> </tr> <tr> <td width="85">Amount</td> <td width="581">: RM <input class="special" name = "ammount_me" maxlength = "7" size = "10"></td> </tr> <tr> <td> </td> <td align="left"> <div align="left"> <input class="button" type = "button" name = "bttnList" value = "List Miscellaneous Expenses" onClick="listMe()"> <input class="button" type = "submit" name = "bttnAdd" value = "Add"> <input class="button" type = "reset" name = "bttnCancel" value = "Reset"> </div></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/128160-how-to-control-date/ Share on other sites More sharing options...
.josh Posted October 13, 2008 Share Posted October 13, 2008 strtotime time Quote Link to comment https://forums.phpfreaks.com/topic/128160-how-to-control-date/#findComment-663876 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.