Validating a web form in php

02-Feb-2018 00:57 by 4 Comments

Validating a web form in php

The “validation descriptor” is a string specifying the type of validation to be performed.For example, “req” means required, “alpha” means allow only alphabetic characters and so on.

The third argument is the error message to be displayed if the validation fails.

Most of cases we will use the * symbol for required field.

Validation means check the input submitted by the user.

There are two types of validation are available in PHP.

In this tutorial, we will see how to use PHP to validate the data collected from a form.

You can download the PHP form validation script below:The zip file contains the form validation script formvalidator.php, documentation and usage samples.

The first argument is the name of the input field in the form.In this tutorial you will learn how to implement a simple contact form on your website that allows the user to send their comment and feedback through email.We will use the same PHP function to send the emails.In this tutorial you'll learn how to sanitize and validate form data using PHP filters.As you have seen in the previous tutorial, the process of capturing and displaying the submitted form data is quite simple.This validation descriptor is for select input items (lists) Normally, the select list boxes will have one item saying ‘Select One’.