dadamssg Posted April 12, 2009 Share Posted April 12, 2009 im creating an update profile script. I'm dealing with their first name right now...if they don't enter anything thats fine, but if they do i want to check it against this regex. the problem is its not checking it against the regex. I can enter Billy#(R& for the first name and it will put that in the db without setting an error. heres what i got to check if its not empty, check against the regex $Fname = clean_data($_POST['firstName']); if($Fname !=="") { if(!preg_match('/^[a-z]{2,20}$/i',$Fname)) { $messages .= "{$_POST['firstname']} is not a valid name.<br>"; } } Link to comment https://forums.phpfreaks.com/topic/153686-help-with-setting-an-error-message/ Share on other sites More sharing options...
9three Posted April 12, 2009 Share Posted April 12, 2009 You need to echo or print the message Link to comment https://forums.phpfreaks.com/topic/153686-help-with-setting-an-error-message/#findComment-807668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.