Jump to content

help with setting an error message


dadamssg

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.