Jump to content

[SOLVED] Help with matching in php


networkthis

Recommended Posts

Here is what I have so far.......I am trying to make sure that the user enters a valid name for a form.  I am going about it this way to display an error on the form is the user tries to enter invalid characters and to let them know that only letters are allowed in the form.  I have everything working great, but when you enter in blank spaces, it will display my error message saying that only letters are allowed in this field.  I guess I just need to know how to allow blank spaces.  Any help is greatly appreciated! 

 

function validate_ABC($text){

  if (preg_match("/[^a-zA-Z]/",$text))

  {

  $valid_ABC = 0;

  } else

  {

  $valid_ABC = 1;

  }

return $valid_ABC;

}

Link to comment
https://forums.phpfreaks.com/topic/104158-solved-help-with-matching-in-php/
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.