Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > PHP / mySQL

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 11-09-2011, 11:48 PM   #1
Trivia
Registered User
 
Join Date: Nov 2011
Location: Austria
Posts: 7
How to apply validations in PHP?

How to apply validations in PHP???
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Trivia is offline   Reply With Quote

Old 02-02-2012, 01:12 AM   #2
jimimartin52
Registered User
 
Join Date: Jan 2012
Posts: 3
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
__________________
Searching for Best Web Design, Development or Affordable SEO Service in USA? Bestwebsol.com provides professional full-cycle services: web development, custom web design & Best SEO services with guaranteed traffic increase and higher ranking.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jimimartin52 is offline   Reply With Quote
Old 02-03-2012, 02:06 AM   #3
Spoint_Vinil
Moderator
 
Join Date: Sep 2011
Location: INDIA
Posts: 250
thanks for the information but can u please let us know how to apply validations in php ?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Spoint_Vinil is offline   Reply With Quote
Old 02-07-2012, 05:33 AM   #4
cyrusholiday
Registered User
 
Join Date: Feb 2012
Posts: 22
hello.........

very nice post.

thanks for the info.

regards,


cyrusholiday
http://www.cyrusholiday.info
cyrusholiday is offline   Reply With Quote
Old 11-06-2013, 12:42 AM   #5
mridul
Registered User
 
Join Date: Sep 2013
Posts: 92
great post such a useful information thanx for sharing.
and keep sharing.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
mridul is offline   Reply With Quote
Old 12-07-2013, 04:18 AM   #6
Luca tall
Registered User
 
Join Date: Apr 2013
Location: Chennai
Posts: 72
Are you asking about PHP form validation?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
Luca tall is offline   Reply With Quote
Old 12-10-2013, 12:07 AM   #7
williamforrest
Registered User
 
Join Date: Oct 2013
Posts: 17
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
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
williamforrest is offline   Reply With Quote
Old 12-18-2013, 05:34 AM   #8
lampdev112
Registered User
 
Join Date: Dec 2013
Posts: 30
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
lampdev112 is offline   Reply With Quote
Old 03-07-2014, 01:31 AM   #9
simar
Registered User
 
Join Date: Mar 2014
Posts: 71
we can use JavaScript for validation.it has a embedded language with php.......
simar is offline   Reply With Quote
Old 03-11-2014, 11:42 PM   #10
alligatortek001
Registered User
 
Join Date: Nov 2013
Posts: 92
jimimartin52...
Its very useful to know about the concept..thanq
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
alligatortek001 is offline   Reply With Quote
Old 03-21-2014, 02:56 PM   #11
azraf
Registered User
 
Join Date: Mar 2014
Posts: 27
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.
__________________
Read free
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
and Portfolio
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
article.
Join Business Learners Community.
For IT support:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| IT Blog
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
azraf is offline   Reply With Quote
Old 03-23-2014, 11:43 PM   #12
mikhapop
Registered User
 
Join Date: Mar 2014
Posts: 19
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
__________________
Mega Business Solutions!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
mikhapop is offline   Reply With Quote
Old 05-28-2014, 02:12 AM   #13
kevinkrieger
Registered User
 
Join Date: Jan 2014
Posts: 104
Form Validation is important particularly if you are going to save the data in a database
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
kevinkrieger is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importance of Php Development for Web Development tech.biztech Programming General 35 11-22-2019 12:37 AM


All times are GMT -7. The time now is 10:39 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.