Welcome Guest, Not a member yet? Register   Sign In
start and end date validation for searches [SOLVED]
#7

[eluser]crwtrue[/eluser]
There is no validation if end_date is after start_date. So i would add this to the datechecker_enddate-function.

After if (checkdate($month, $day, $year)) line use strtotime-function to make dates in to unix timestamp like this:

$start_date = strtotime($start_date);
$end_date = strtotime($end_date);

and then check if end_date is after start_date like this:

Code:
if ($start_date < $end_date)
             {
              return TRUE;
             }
             ELSE
             {
              $this->form_validation->set_message('_datechecker_enddate', 'end_date must be after start_date');
                    return FALSE;
             }

Also i noticed that when you are calling the datechecker_enddate-function you are allready passing the end_date-value to datechecker_enddate-function but you are also reading both start_date and end_date to variables using post-function and you are using both $date and $end_date-variables which has the same value.


Messages In This Thread
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 02:02 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 02:43 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 03:14 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 03:20 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 10:11 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-11-2009, 07:52 AM
start and end date validation for searches [SOLVED] - by El Forum - 02-08-2010, 05:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB