|
|
|
Form & component validation using PHP |
Forms are mainly used to collect user entered data to the system. We enter our login data or use one signup form to enter data as a user to a database table or to a form processing script. There are different components like text box, radio buttons, checkbox, combo box or drop down list boxes for users to enter data to a system. You can read more details on web form and its components in out HTML section.
To handle various display and design issues we have to use front end tool like HTML or JavaScript. Our server side script PHP is used to handle the data as entered by users. We also need PHP to validate the data and post back the error messages if validation fails.
We will discuss some basic issues relating to handling of form components and some sample codes here.
Basics of Form in PHP
How to collect the data from a simple html form and display all the variables of the form.
Data Validation and posting back
We discuss how all types of html components are handled in a form and error message is posted back to users if any checking is failed. Read More
How to retain form data
Once a user entered some data and submitted the form then in case of failure of data validation the user need not enter the data again. User can just edit the entered data to match the requirements. So how to post back the data if validation fails ? Read More
Checkbox
Checkboxes are used when user has to select more than one option from a group of options available to it. We will discuss more on where to use checkbox inside a form. Read More
Text Box
Text box is the most commonly used form component. How to use text boxes and how to retain data if form validation fails? . Read More
Check box
How to handle the post back data for a check box if validation fails? User need not check the same data again. Read More
Check box data storing in a table.
We can select data stored in a table and based on this keep the checkboxes checked by default. Once the status of the checkbox changed by user the same status of each check box can be retained by updating the data in a mysql table. Read More
Period button post back data holding
Radio buttons ( or period ) are used when user has to select one of the many options. Once the validation of form fails then how to retain the selected value of the user in the set of period buttons? Read More
Drop down list box or Combo box
These boxes allows user to select one of the many pull down options available. Once the form is submitted and users is required to enter the form data again then how to retain the previously selected option of the user. Read More
List box with multiple selection
There are drop down list boxes with multiple selections, how to collect selected options in a drop down list box ?Read More
Date validation
In many forms dates are entered by user using various components. How to check the date entered by user is a valid date data or not Read More
Email Validation
Email fields are used in the form. How to check the email format as entered by the users.Read More
Email Validation using Ajax
Using Ajax technology we can validate email address before finally submitting the form. Read More
Simple way to validate form
Here is a simple way to validate data entered by user. Read More
Checking for numeric number only
In some fields we can only allow numeric value to be entered. This function can take care of decimal values also. Read More
Allowing only alphanumeric characters only
How to check entries only for characters ( A to Z ) and numbers? The function is useful to check userid and password entered by users. Read More
Only alphabets
Here is an function to check uses of alphabets only. Any thing other than alphabet used can be checked. Read More
Register_global setting
How to handle data if register_global is set to OFF at php.ini file. In PHP5 and above register_global is by default set to OFFRead More
| |
|
|
|