Jump to content

quick question


adv

Recommended Posts

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 :D

thanks in advance

 

Link to comment
https://forums.phpfreaks.com/topic/121137-quick-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.