Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.