Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   How to apply validations in PHP? (http://siteownersforums.com/showthread.php?t=52381)

Trivia 11-09-2011 11:48 PM

How to apply validations in PHP?
 
How to apply validations in PHP???

jimimartin52 02-02-2012 01:12 AM

Hi! Today we are going to review a very important part of the development process of a web application. The validation of users input. This is one the trickiest parts of any application at all. Why is that? Because the developer doesn't control it. You can write the best algorithm in the world, but still if it includes user input there is a place for mistakes. Even if we put some coplicated logic to prevent the input of wrong symbols, check the consistence of the data and do whatever possible to make sure that it is all OK, there is still possibility that the users enter the wrong number. Though all said, we must try to prevent the most of human errors and the best way to do this is by using Regular Expressions.

Basicly Regular Expressions are used for string matches. They are based on search and pattern matching strings in text. A lot of books are written about them, there are even some programming languages designed especially for Regular Expressions. But today we are just going to take a brief look at how regular expressions can help us with user input. First of all I suggest that you get familiar with some basic concepts of the language.
Now let's get to work. I'll present some of the most common problems with user input. I'm pretty sure that you met most of them if not all. We are going to create a registration form with required input fields. They are as follows:
- Full Name
- Address
- Passport
- Email
- Phone
- Zip code
- Date
- Username
- Password

-----------------------------------
http://www.bestwebsol.com

Spoint_Vinil 02-03-2012 02:06 AM

thanks for the information but can u please let us know how to apply validations in php ?

cyrusholiday 02-07-2012 05:33 AM

hello.........

very nice post.

thanks for the info.

regards,


cyrusholiday
http://www.cyrusholiday.info

mridul 11-06-2013 12:42 AM

great post such a useful information thanx for sharing.
and keep sharing.

Luca tall 12-07-2013 04:18 AM

Are you asking about PHP form validation?

williamforrest 12-10-2013 12:07 AM

you can use 3rd party validation classes.. or you can read more here, stackoverflow dot com/questions/737385/easiest-form-validation-library-for-php#answer

lampdev112 12-18-2013 05:34 AM

There are two ways to use regular expressions in php. One is the true PHP style in which case we have to use ereg() function and the other is to use Perl style syntax for our validations. In this case we have to use preg_match() function. In this tutorial we will use preg_match() because it is faster in most cases and also supports the most common regular expression syntax. It also gives us more capabilities, that we can use.

simar 03-07-2014 01:31 AM

we can use JavaScript for validation.it has a embedded language with php.......

alligatortek001 03-11-2014 11:42 PM

jimimartin52...
Its very useful to know about the concept..thanq

azraf 03-21-2014 02:56 PM

For validating (I assume you are talking about form validation, correct me if I am wrong), best way is to use JavaScript Validation. You can use jQuery or any JS library you are using. For serverside validation, you have to build logic by yourself.

mikhapop 03-23-2014 11:43 PM

you will use if statements for validation
for example
if(strln($password) < 8)
{
echo "Your Password must be 8 char. at least";
}

and so on, and also you will use regular expressions a lot

kevinkrieger 05-28-2014 02:12 AM

Form Validation is important particularly if you are going to save the data in a database


All times are GMT -7. The time now is 03:11 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.