Validate a correct month format 1-12???
Posted: Fri Jan 27, 2006 9:35 am
feyd | Please use
When I enter 22 the validation doesn't work(which it shouldn't) but when I enter 8 or 08 I get back 2 and still get the error message. What am I doing wrong??
Thanks!!
ROB
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi, I'm trying to make sure a user can only put in 1 - 12 for a month field.
Here's the code I'm trying:Code: Select all
//policy_eff_date_mo Policy Start Date Month
$policy_eff_date_mo = settype($policy_eff_date_mo, int) + 1;
if($policy_eff_date_mo == '' || ($policy_eff_date_mo >= 1 AND $policy_eff_date_mo <= 12)) {
$error_msg.="Please enter a Policy Start Date month. (i.e. Feb = 2 or Dec = 12)<br>";
}When I enter 22 the validation doesn't work(which it shouldn't) but when I enter 8 or 08 I get back 2 and still get the error message. What am I doing wrong??
Thanks!!
ROB
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]