php learner
php learner

Reputation: 251

how to do special character validation in PHP

I have lot of textarea fields to add comments and quotes. How can I validate these fields. I checked null validation other than null validation what validation I have to do?

Upvotes: 0

Views: 1223

Answers (2)

Tobi
Tobi

Reputation: 2828

!empty( $text ) && strlen( $text ) > 123 && !preg_match('/(<[a-z]+>)/', $text )

... and so on...

Upvotes: 0

Babiker
Babiker

Reputation: 18798

Some things you need to check :

  • empty values

  • numbers only

  • input length

  • email address

  • strip html tags

Credit : php-mysql-tutorial.com

Upvotes: 1

Related Questions