adv Posted August 24, 2008 Share Posted August 24, 2008 hello i have a question <?php function test($day,$month,$year){ if($day<01||$day>31){ return false; } if(!is_numeric($month)){ return false; } if($year<07){ return false; } return true; } ?> and the html <input type="text" name="day" value="" size="2" maxlength="2"><br /> <input type="text" name="month" value=""><br /> <input type="text" name="year" value="" maxlength="2" size="2"><br /> and if i try this <?php $day=$_POST['day']; $month=$_POST['month']; $year=$_POST['year']; test($day,$month,$year); ?> 1 -does it workes how it seens its takes the $day and check within the function if less then 01 and higher then 31.. etc 2 -and if i put test("",$month,$year); does it leaves the first to nothing and check the other two 3- does it have any flaws or bugs ?? Also this is just a practical question thanks in advance Link to comment https://forums.phpfreaks.com/topic/121137-quick-question/ Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 1. yes , as far as i can see 2. not sure , try it 3.yes, if($day<01||$day>31){ what if you put 7 , will it still work, try it Link to comment https://forums.phpfreaks.com/topic/121137-quick-question/#findComment-624489 Share on other sites More sharing options...
redarrow Posted August 24, 2008 Share Posted August 24, 2008 It will always return false code is correct ...... Link to comment https://forums.phpfreaks.com/topic/121137-quick-question/#findComment-624490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.