Jump to content

PHP form validation


Mateobus

Recommended Posts

[quote author=gijew link=topic=102502.msg406858#msg406858 date=1154386656]
This isn't perfect but...

if (preg_match('/^[0-9a-zA-Z]+$/i', $_POST['FieldName'])) {
  echo 'matches';
} else {
  echo 'no match';
}
[/quote]
if you have the i modifier, you dont need the a-z bit in the expression gijew. So the expression can be just:
[code]/^[0-9A-Z]+$/i[/code]
Link to comment
https://forums.phpfreaks.com/topic/16153-php-form-validation/#findComment-66904
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.