Jump to content

Explode!


xyn

Recommended Posts

Hey,
I have a date of birth, i want to check that when the user
enters their date of birth when they register it checks for
NN NN NNNN - No less that them exact values.

For security, when they want to change their password I
wanted them to TYPE their date of birth in, instead of
selecting from a drop down...

My code is completely ioff the track, so could someone
please help me? thanks.

[code=php:0]<?PHP
$str = "".$_POST[dob_d]."/".$_POST[dob_m]."/".$_POST[dob_y]."");
$dob = explode("/", $str);

for($dob[0]=0; $dob[0]>2){ //Check day
echo 'Enter a valid day, in your Date of birth.';
return false;
}

for($dob[1]=0; $dob[1]>2){ //check month
echo 'Enter a valid month, in your Date of birth.';
return false;
}

for($dob[2]=0; $dob[2]>4){ //check year
echo 'Enter a valid Year, in your Date of birth.';
return false;
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/23021-explode/
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.