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? Link to comment https://forums.phpfreaks.com/topic/104402-validate-a-space/ Share on other sites More sharing options...
moselkady Posted May 6, 2008 Share Posted May 6, 2008 try: if (!eregi ("^[[:alnum:] ]+$", $COStreet)){ $valid="NOPE"; } Link to comment https://forums.phpfreaks.com/topic/104402-validate-a-space/#findComment-534463 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>'; Link to comment https://forums.phpfreaks.com/topic/104402-validate-a-space/#findComment-534469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.