A form on a web page allows a user to enter data that is, typically, sent to a server for processing and to mimic the usage of paper forms. Forms can be used to submit data to save on a server (e.g., ordering a product) or can be used to retrieve data (e.g., searching on a search engine).
The following are a list of elements that can make up the user-inputting portion a form:
These basic elements provide most possible graphical user interface (GUI) elements, but not all. For example, there are no equivalents to a combutcons, balloon help, tree views, nor grid views. A grid view, however, can be mimicked by using a standard HTML table with each cell containing a text input element. A tree view could also be mimicked through nested tables.
The sample image on the right shows all of these elements:
While client-side languages used in conjuction with forms are limited, they often can serve to do pre-validation of the form data and/or to prepare the form data to send to a server-side program.
The advantage of server-side over client-side is the concentration of functionality onto one computer (the server) instead of relying on each web browser implementing all of the various functions the same. This very problem is quite evident to any developer who writes JavaScript code for multiple browsers.
Scripting languages are the most common server-side programs used for web sites, but it is also possible to run compiled programs.
Some of the scripting languages commonly used:
Some of the compiling languages commonly used:
A PHP script may:
The HTML form learns to where it shall pass the data from the action attribute of the form's HTML element. The target PHP file then retrieves the data either through POST or GET (see HTTP for more information), depending on the programmer's preference. Here is a basic form handler PHP script that will post the form's contents, in this case "user", to the page using POST:
form.html
form_handler.php
$name = $_POST*; echo "Hello, ". $name ."!
"; ?>
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Form (web)".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world