Guest zenkitty Posted August 17, 2007 Share Posted August 17, 2007 Hi - my client wants it so the postcode on the registration form can contain numbers only (she only sells to Australian customers). I thought this would be a relatively simple thing to check for, but can't seem to get it to work. In includes/content/reg.inc.php, under the check for the phone number, I've added this: } elseif(!ereg("[0-9]",$_POST['postcode'])) { $errorMsg = $lang['front']['reg']['enter_valid_postcode']; so that I now have this: if(empty($_POST['firstName']) || empty($_POST['lastName']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['add_1']) || empty($_POST['town']) || empty($_POST['county']) || empty($_POST['postcode']) || empty($_POST['country']) || empty($_POST['password']) || empty($_POST['passwordConf'])){ $errorMsg = $lang['front']['reg']['fill_required']; } elseif($_POST['password'] !== $_POST['passwordConf']) { $errorMsg = $lang['front']['reg']['pass_not_match']; } elseif(validateEmail($_POST['email'])==FALSE) { $errorMsg = $lang['front']['reg']['enter_valid_email']; } elseif(!ereg("[0-9]",$_POST['phone'])) { $errorMsg = $lang['front']['reg']['enter_valid_tel']; } elseif(!ereg("[0-9]",$_POST['postcode'])) { $errorMsg = $lang['front']['reg']['enter_valid_postcode']; } elseif(!empty($_POST['mobile']) && !ereg("[0-9]",$_POST['mobile'])) { $errorMsg = $lang['front']['reg']['enter_valid_tel']; } I also added the following into language/en/lang.inc.php under the line for 'enter_valid_tel': 'enter_valid_postcode' => "Please enter a valid postcode.", However, this doesn't work - the registration form can still be submitted with letters in the postcode field. Have I got the right files? Is there something I've missed? You can probably tell my PHP skills aren't that great, so if anyone could give me a hand to get this to work it would be greatly appreciated. Thanks! - Deb Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.