xyn Posted October 4, 2006 Share Posted October 4, 2006 Hey,I have a date of birth, i want to check that when the userenters their date of birth when they register it checks forNN NN NNNN - No less that them exact values.For security, when they want to change their password Iwanted them to TYPE their date of birth in, instead ofselecting from a drop down...My code is completely ioff the track, so could someoneplease 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 dayecho 'Enter a valid day, in your Date of birth.';return false;}for($dob[1]=0; $dob[1]>2){ //check monthecho 'Enter a valid month, in your Date of birth.';return false;}for($dob[2]=0; $dob[2]>4){ //check yearecho '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 More sharing options...
tleisher Posted October 4, 2006 Share Posted October 4, 2006 Why not give them a drop down list? It's not any less secure, and it'll help you from having to code number limits... that way you dont get people entering their birthday is 99/99/9999 Link to comment https://forums.phpfreaks.com/topic/23021-explode/#findComment-103949 Share on other sites More sharing options...
Jocka Posted October 4, 2006 Share Posted October 4, 2006 well if they have to type it in then change the names.dob_d, dob_m, dob_yday, month, yearthat way explode isn't needed. You can just use $_POST['dob_d'] m and y Link to comment https://forums.phpfreaks.com/topic/23021-explode/#findComment-103950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.