<form id="form1" name="form1" method="post" action="thanks.php">
<label for="text"></label>
<textarea name="text" id="text" cols="87" rows="9"></textarea>
<br/> <br/><br/><input type="submit" name="submit" id="go" value="Submit" />
</form>
This is my form, i want to validate the textarea : only letters, space and numbers allowed. i want to avoid "+-*()?|/\"
can any one help me ? i want to validate with php ....
Validating a textarea
Moderator: General Moderators
Re: Validating a textarea
i got it from a book
we can check it with regular expressions
# string validation
ereg(“[^-’A-Za-z0-9 \t]”, “don’t forget about secu-rity”); // Boolean(false)
we can check it with regular expressions
# string validation
ereg(“[^-’A-Za-z0-9 \t]”, “don’t forget about secu-rity”); // Boolean(false)
Re: Validating a textarea
Don't use ereg.
Code: Select all
preg_match('/[^a-z0-9\s]/i', $text) // should be falseRe: Validating a textarea
ereg(“[^-’A-Za-z0-9 \t]”, “don’t forget about secu-rity”); // Boolean(false)
preg_match('/[^a-z0-9\s]/i', $text) // should be false
What is the difference between ereg and preg_match ????? and why u said Don't use ereg ???
preg_match('/[^a-z0-9\s]/i', $text) // should be false
What is the difference between ereg and preg_match ????? and why u said Don't use ereg ???
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Validating a textarea
http://us3.php.net/manual/en/function.ereg.php: You see the big warning in red?nithinkk wrote:ereg(“[^-’A-Za-z0-9 \t]”, “don’t forget about secu-rity”); // Boolean(false)
preg_match('/[^a-z0-9\s]/i', $text) // should be false
What is the difference between ereg and preg_match ????? and why u said Don't use ereg ???
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Validating a textarea
thanks 