Logic problem
Posted: Sun Feb 24, 2008 8:34 am
I have created a function, validDate(), which validates dates. It returns 0 if the format is OK and the date is valid.
I need to check two textfields for possible user date input. Such input is only meaningful if they have first selected a date field, from a select list, to search from which is called $dates.
So I have:
but it is not operating as expected right now. Can anyone please see where my logic is at fault?
If either of the date validations returns zero and $dates == "Please select a date field to search on" then generate the html error message.
I need to check two textfields for possible user date input. Such input is only meaningful if they have first selected a date field, from a select list, to search from which is called $dates.
So I have:
Code: Select all
if((validDate($dateFrom) == 0) || (validDate($dateTo) == 0) && ($dates == "Please select a date field to search on"))
{
$errors = 1;
$table .=
"
<table width='100%' border='0' cellpadding='1'>
<tr>
<td class='warning'><div align='center'>ERROR! - Please select a date field to search on</div></td>
</tr>
</table>
";
}
If either of the date validations returns zero and $dates == "Please select a date field to search on" then generate the html error message.