phpretard Posted May 6, 2008 Share Posted May 6, 2008 I am trying to validate a street address. I have managed to accept only letters and number but my code won't allow for a space. if (!eregi ("^[[:alnum:]+]+$", $COStreet)){ $valid="NOPE"; } Any helpers? Quote Link to comment Share on other sites More sharing options...
moselkady Posted May 6, 2008 Share Posted May 6, 2008 try: if (!eregi ("^[[:alnum:] ]+$", $COStreet)){ $valid="NOPE"; } Quote Link to comment Share on other sites More sharing options...
ady01 Posted May 6, 2008 Share Posted May 6, 2008 If you cant get that going might be worth trying this : Dont know if this will help yet as I can't see your Variables. You will need to amened $erraddress to your own Variable (what every you have used) if(preg_match("/^[a-zA-Z0-9 _-.,:\"\']+$/", $_POST["address"]) === 0) $errAddress = '<p class="errText">Address must be only letters, numbers or one of the following _ - . , : " '</p>'; 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.