even better, verify the date as a whole rather then just as an int.

<?php

 $time = mktime(0, 0, 0, $month, $day, $year);
 
 $date  = getdate($time);
 $month = $date['mon'];
 $day  = $date['mday'];
 $year  = $date['year'];

?>

there you go, try it. someone puts an invalid date in? no problem it fixes it for you.


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Matt Williams"" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi

I am trying to validate a form to check the user has entered there date of
birth correctly
There are three fields day, month & year.

how can I check whether a string is a number?

I have tried using is_long(), is_int(), is_integer() to check the values
,but it doesn't seem to be working.

the code I have tried is

if(!is_int($dobd))
{
  print "error";
}
else
{
  //carry on
}

could someone help me as to where I'm going wrong

TIA

M@


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to