shank888 Posted May 11, 2008 Share Posted May 11, 2008 Hi. Every time I go and submit my form and try to verify a users birthdate uisng checkdate() i always get error: Warning: checkdate() expects parameter 1 to be long, string given in FILENAME/register2.php on line 78 my code is: if (!checkdate($_POST['year'],$_POST['month'],$_POST['day'])) { print "<p>You have entered an invalid Birthdate </p>"; } edit: Just want to know what this error means and how I may be able to fix it. Thanx Link to comment https://forums.phpfreaks.com/topic/105159-checkdate-error/ Share on other sites More sharing options...
rarebit Posted May 11, 2008 Share Posted May 11, 2008 prolly depends what your putting through, but if you cover it with something like this: if( (is_numeric($_POST['year'])) && (is_numeric($_POST['month'])) && (is_numeric($_POST['day'])) ) { if (!checkdate(intval($_POST['year']),intval($_POST['month']),intval($_POST['day']))) { print "<p>You have entered an invalid Birthdate </p>"; } } else { print "<p>Invalid input!</p>"; } Edit: added intval Link to comment https://forums.phpfreaks.com/topic/105159-checkdate-error/#findComment-538410 Share on other sites More sharing options...
shank888 Posted May 11, 2008 Author Share Posted May 11, 2008 kool thanx! it takes away the errors but it says all dates are invalid. example here: http://babble-net.com/register2.php Link to comment https://forums.phpfreaks.com/topic/105159-checkdate-error/#findComment-538433 Share on other sites More sharing options...
BlueSkyIS Posted May 11, 2008 Share Posted May 11, 2008 echo intval($_POST['year']),intval($_POST['month']),intval($_POST['day']) and see if the values are okay. Link to comment https://forums.phpfreaks.com/topic/105159-checkdate-error/#findComment-538485 Share on other sites More sharing options...
shank888 Posted May 11, 2008 Author Share Posted May 11, 2008 echo intval($_POST['year']),intval($_POST['month']),intval($_POST['day']) and see if the values are okay. I beleive the valuve are correct. When I entered Feburay 26 1989 it shows value as: 1989226 which to me would be 1989 2 26 Link to comment https://forums.phpfreaks.com/topic/105159-checkdate-error/#findComment-538489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.