Hi Friends,
Today we will learn how to use php to validate form data.
Validations of form data is very important to protect your form from hackers and spammers...
In this Tutorial We will used following html form to demonstrate form validation in PHP
When the form is submitted, the form data is sent with method="post".
Today we will learn how to use php to validate form data.
Validations of form data is very important to protect your form from hackers and spammers...
In this Tutorial We will used following html form to demonstrate form validation in PHP
The Code Is :
Screen Shot Before Submit :
Screen Shot on Submit without enter data :
Screen Shot on Submit after enter data :
Rules For Fields :
Our Fields | Validation Rules |
---|---|
Name | Required. + Must only contain letters and whitespace |
Required. + Must contain a valid email address (with @ and .) | |
Website | Optional. If present, it must contain a valid URL |
Comment | Optional. Multi-line input field (textarea) |
Gender | Required. Must select one |
When the form is submitted, the form data is sent with method="post".
Comments
Post a Comment