Jump to content

Help pls validating input box.How?


bladez

Recommended Posts

i have a form for login n password

i want to validate on server site to check if the content are either characters or numbers only ...

 

Example :

 

Username : bladez                    - accecpted

Username : bladez99                - accecpted

Username : *>dsa*dad            - Rejected

Username : <?php bla ?>        - rejected

 

Which means if it doesnt meet those pattents its an error ..how do i do that in PHP?

Link to comment
https://forums.phpfreaks.com/topic/69063-help-pls-validating-input-boxhow/
Share on other sites

To validate particular patterns, you'll need to venture into regular expressions.

 

Here is a helpful tutorial:

http://weblogtoolscollection.com/regex/regex.php

 

Or just go to:

http://us3.php.net/regex

 

 

The number portion of it you can check with the is_numeric function.

So

<?php if (!is_numeric($POST['variable'])) {
// Errors here
} ?>

 

 

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.