PHP
  Home arrow PHP arrow Advanced PHP Form Input Validation to Check User Inputs
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Advanced PHP Form Input Validation to Check User Inputs
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2009-06-01


    Table of Contents:
  • Advanced PHP Form Input Validation to Check User Inputs
  • Validating Email Addresses
  • Validating Domains for Email Addresses
  • Validating Alphanumeric, Numeric and Alphabetic Input

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Advanced PHP Form Input Validation to Check User Inputs
    ( Page 1 of 4 )

    PHP form input validation is what separates amateur and professional PHP developers. A professional PHP developer validates data for both security and correctness of the data entered. Keep reading to learn how to validate user input to your forms.

    Web form processing is one of the most important tasks any website can do to process customer-related information. PHP server side scripting offers a variety of solutions for accepting and processing data inputs from any web form.

    However, a lot of website forms do not have input validation. "Input validation" is the process of double checking form data input to ensure they are the correct data the server needs to process. Without proper form input validation, the web server and database will process or store the wrong information.

    A classic example concerns forms that ask for an email address. If you do not validate the input data, malicious users can enter other types of characters into the form to hack your MySQL database. Serious website security issues, such as MySQL injection and malware injection, result from improper form input validation.

    In this article, we will aim to provide PHP solutions which will validate the most common fields used in  website development:

    • Validating alphanumeric input -- This type of input is commonly used for usernames and passwords. "Alphanumeric" means the variable can contain numbers and letters of the alphabet only.

    • Validating numeric input -- Often, web forms ask for numbers. These can be phone numbers or credit card numbers. Other important applications include asking for a birth date, numbers would be entered by the user for the day, month and year of birth. That's numerical data.

    • Validating names -- This kind of validation should check for letters of the alphabet only; user input should not contain numbers.

    • Validating email address -- The email address is most commonly asked for in a web form. It's particularly common for a log-in page.

    • Validating for empty fields -- Often, certain fields must be filled on an online form, and the user is not permitted to leave them blank. 



     
     
    >>> More PHP Articles          >>> More By Codex-M
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT