Form (web)
Encyclopedia
A webform on a web page
allows a user to enter data that is sent to a server
for processing. Webforms resemble paper
or database
forms because internet users fill out the forms using checkboxes, radio buttons, or text fields. For example, webforms can be used to enter shipping or credit card data to order a product or can be used to retrieve data (e.g., searching on a search engine
).
In addition to functioning as input templates for new information, webforms can also be used to query and display existing data in a similar manner to mail merge
forms, with the same advantages. The decoupling of message structure and underlying data allow both to vary independently. The use of webforms for this purpose avoids the problems associated with explicitly creating separate web pages for each record in a database.
Webforms are defined in formal programming languages such as HTML
, Perl
, PHP
, Java
, Javascript
or .NET
(including ASP.NET
). The implementations of these languages often automatically invoke user interface idioms, such as grids and themes
, minimizing programming time, costs and risks.
or HTML
is by far the most common way to use a form online.
The following elements can make up the user-inputting portion of a form:
The sample image on the right shows all of these elements:
These basic elements provide most possible graphical user interface
(GUI) elements, but not all. For example, there are no equivalents to a combo box
, balloon help
, tree view
, or grid view
.
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 or, more semantically appropriately, nested lists.
Many of these are available through JavaScript libraries
.
When data that has been entered into HTML forms is submitted, the form control names and values are encoded and sent to the server in an HTTP request message using method GET or POST
, or, historically, via email
. The default encoding, MIME type application/x-www-form-urlencoded, is based on a very early version of the general URI percent-encoding
rules, with a number of modifications such as newline
normalization and replacing spaces with "
An XForms document can be as simple as an HTML / XHTML web form. But XForms includes many advanced features. For example, the form can react in real time and request and retrieve new information while it is still being displayed, without the use of a separate scripting language. The form can specify how its data should be validated
or how portions of the form may change depending on data entered in other parts of the form.
Unlike HTML / XHTML forms, XForms is not currently supported on available web browsers.
s to allow developer
s to create dynamic web sites.
This includes both client-side and/or server-side languages.
client-side scripting
language for web sites is JavaScript
.
Utilizing JavaScript on the Document Object Model
(DOM) leads to the method of Dynamic HTML
that allows dynamic creation and modification of a web page within the browser.
While client-side languages used in conjunction 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.
a login
through, for example, Lightweight Directory Access Protocol
to retrieving and storing data in a database
to spell checking
to sending e-mail
— quite unlike client-side programs.
Some server-side program requests must pass through the web server
's Common Gateway Interface
to execute
the program to actually perform the tasks.
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:
is one very common language used for server-side languages and is one of the few languages created specifically for server-side programs.
A PHP script may:
The HTML form learns where to 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 GET:
form.html
form_handler.php
In the above script the $_GET[ ] and $_POST[ ] commands need to be changed, depending on what is used in the form, however $_REQUEST[ ] is used for both so it is more efficient to use for form collection. Note that the value used in input name="" in the html form must be the same as the array value in the $GET[ ] expression in the PHP form handler program.
is another language often used for web development
. Perl scripts are traditionally used as Common Gateway Interface
applications (CGIs). In fact, Perl is such a common way to write CGIs that the two are often confused. CGIs may be written in other languages than Perl (compatibility with multiple languages is a design goal of the CGI protocol) and there are other ways to make Perl scripts interoperate with a web server
than using CGI (such as FastCGI
or Apache
's mod perl
).
Perl CGIs were once a very common way to write web applications. But not being specifically designed for web development, Perl is now often viewed as less practical (both for developers and users) than specialized languages like PHP
or ASP
. This is especially true if Perl module
s would need to be installed on the web host or if wanting to use a non-CGI environment that might require extra configurations on the web server. Some web hosts also rely on interpreter-level sandboxing
, which while possible with the Safe module, wouldn't be very practical and undoubtly break a lot of scripts considering common practices. Similar considerations might apply to other general-purpose scripting languages like Python
or Ruby
. For these reasons, a lot of cheap web hosts nowadays effectively only support PHP and web developers often seek compatibility with them.
A modern Perl 5 CGI using the standard CGI module with a form similar to the one above might look like:
form_handler.pl
To avoid the confusion and difficulty of installing and using scripts, webmasters often use a free forms processing service to get their forms working.
and Doteasy
provide templates to their clients as an add-on free service. Others offer free contact forms installable on any hosted website.
Web page
A web page or webpage is a document or information resource that is suitable for the World Wide Web and can be accessed through a web browser and displayed on a monitor or mobile device. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext...
allows a user to enter data that is sent to a server
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
for processing. Webforms resemble paper
Form (document)
A form is a document with spaces in which to write or select, for a series of documents with similar contents. The documents usually have the printed parts in common, possibly except for a serial number...
or database
Database
A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality , in a way that supports processes requiring this information...
forms because internet users fill out the forms using checkboxes, radio buttons, or text fields. For example, webforms can be used to enter shipping or credit card data to order a product or can be used to retrieve data (e.g., searching on a search engine
Search engine
A search engine is an information retrieval system designed to help find information stored on a computer system. The search results are usually presented in a list and are commonly called hits. Search engines help to minimize the time required to find information and the amount of information...
).
In addition to functioning as input templates for new information, webforms can also be used to query and display existing data in a similar manner to mail merge
Mail merge
Mail merge is a software function which allows to create multiple documents from a single template form and a structured data source.-History:This technique of merging data to create gave rise to the term mail merge....
forms, with the same advantages. The decoupling of message structure and underlying data allow both to vary independently. The use of webforms for this purpose avoids the problems associated with explicitly creating separate web pages for each record in a database.
Webforms are defined in formal programming languages such as HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
, Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
, PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
, Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
, Javascript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
or .NET
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
(including ASP.NET
ASP.NET
ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages ...
). The implementations of these languages often automatically invoke user interface idioms, such as grids and themes
Theme (computing)
In computing, a theme is a preset package containing graphical appearance details, used to customize the look and feel of an operating system, widget set or window manager....
, minimizing programming time, costs and risks.
XHTML/HTML forms
A form in XHTMLXHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....
or HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
is by far the most common way to use a form online.
The following elements can make up the user-inputting portion of a form:
- input field
- text — a simple text boxText boxA text box, text field or text entry box is a kind of widget used when building a graphical user interface . A text box's purpose is to allow the user to input text information to be used by the program...
that allows input of a single line of text (an alternative, password, is used for security purposes, in which the characters typed in are invisible or replaced by symbols such as *) - checkbox — a check boxCheck boxIn computing, a checkbox is a graphical user interface element that permits the user to make multiple selections from a number of options or to have the user answer yes or no on a simple yes/no question.Normally, checkboxes are shown on...
- radio — a radio buttonRadio buttonA radio button or option button is a type of graphical user interface element that allows the user to choose only one of a predefined set of options....
- file — a file selectFile selectIn HTML, a file-select control is a component of a web form with which a user can select a file from his local machine. When the form is submitted , the file is uploaded to the web server. There, when the file arrives, some action usually takes place, such as saving the file on the web server...
control for uploading a file - reset — a reset buttonReset buttonIn electronics and technology, a reset button is a button that can reset a device. On video game consoles, the reset button restarts the game, losing the player's unsaved progress. On personal computersOn IBM mainframes reset neither clears memory nor initiates an IPL., the reset button clears the...
that, when activated, tells the browser to restore the values to their initial values. - submit — a buttonButton (computing)In computing, a button is a user interface element that provides the user a simple way to trigger an event, like searching for a query at a search engine, or to interact with dialog boxes, like confirming an action.-Description:A typical button is a rectangle or rounded rectangle, wider than it is...
that tells the browser to take action on the form (typically to send it to a server)
- text — a simple text box
- textarea — much like the text input field except a textarea allows for multiple rows of data to be shown and entered
- select — a drop-down listDrop-down listIn computing with graphical user interfaces, a drop-down list is a user interface control GUI element , similar to a list box, which allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. When activated, it displays a list of values, from...
that displays a list of items a user can select from
The sample image on the right shows all of these elements:
- a text box asking for your name
- a pair of radio buttons asking you to pick your sex
- a select boxDrop-down listIn computing with graphical user interfaces, a drop-down list is a user interface control GUI element , similar to a list box, which allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. When activated, it displays a list of values, from...
giving you a list of eye colors to choose from - a pair of check boxes to click on if they apply to you
- a text area to describe your athletic ability
- a submit button to send it to the server
These basic elements provide most possible graphical user interface
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
(GUI) elements, but not all. For example, there are no equivalents to a combo box
Combo box
A combo box is a commonly used graphical user interface widget . It is a combination of a drop-down list or list box and a single-line textbox, allowing the user to either type a value directly into the control or choose from a list of existing options.Combo boxes are typically applied to provide...
, balloon help
Balloon help
Balloon help was a help system introduced by Apple Computer in their 1991 release of System 7.0. The name referred to the way the help text was displayed, in "balloons", like those containing the words in a comic strip...
, tree view
Tree view
A tree view or an outline view is a graphical user interface element that presents a hierarchical view of information. Each item can have a number of subitems...
, or grid view
Grid view
A grid view or a datagrid is a graphical user interface element that presents a tabular view of data. A typical grid view also supports some or all of the following:* Clicking a column header to change the sort order of the grid...
.
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 or, more semantically appropriately, nested lists.
Many of these are available through JavaScript libraries
JavaScript library
A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies....
.
When data that has been entered into HTML forms is submitted, the form control names and values are encoded and sent to the server in an HTTP request message using method GET or POST
POST (HTTP)
In computing, POST is one of many request methods supported by the HTTP protocol used by the World Wide Web. The POST request method is used when the client needs to send data to the server as part of the request, such as when uploading a file or submitting a completed form.In contrast to the GET...
, or, historically, via email
Email
Electronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the...
. The default encoding, MIME type application/x-www-form-urlencoded, is based on a very early version of the general URI percent-encoding
Percent-encoding
Percent-encoding, also known as URL encoding, is a mechanism for encoding information in a Uniform Resource Identifier under certain circumstances. Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier set, which includes both Uniform...
rules, with a number of modifications such as newline
Newline
In computing, a newline, also known as a line break or end-of-line marker, is a special character or sequence of characters signifying the end of a line of text. The name comes from the fact that the next character after the newline will appear on a new line—that is, on the next line below the...
normalization and replacing spaces with "
+
" instead of "%20
". Another possible encoding, MIME type multipart/form-data, is also available and is common for POST-based file submissions.XForms
XForms is an alternative standard designed to represent the next generation of HTML / XHTML forms. It is also a standard that is generic enough to be used in a standalone manner or with presentation languages other than HTML or XHTML to describe forms in other user interfaces. Unlike HTML / XHTML forms, XForms uses a model–view–controller approach.An XForms document can be as simple as an HTML / XHTML web form. But XForms includes many advanced features. For example, the form can react in real time and request and retrieve new information while it is still being displayed, without the use of a separate scripting language. The form can specify how its data should be validated
Data validation
In computer science, data validation is the process of ensuring that a program operates on clean, correct and useful data. It uses routines, often called "validation rules" or "check routines", that check for correctness, meaningfulness, and security of data that are input to the system...
or how portions of the form may change depending on data entered in other parts of the form.
Unlike HTML / XHTML forms, XForms is not currently supported on available web browsers.
Combined with scripting languages
Forms can be combined with various scripting languageScripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...
s to allow developer
Software developer
A software developer is a person concerned with facets of the software development process. Their work includes researching, designing, developing, and testing software. A software developer may take part in design, computer programming, or software project management...
s to create dynamic web sites.
This includes both client-side and/or server-side languages.
Client-side
The de factoDe facto standard
A de facto standard is a custom, convention, product, or system that has achieved a dominant position by public acceptance or market forces...
client-side scripting
Client-side scripting
Client-side scripting generally refers to the class of computer programs on the web that are executed client-side, by the user's web browser, instead of server-side...
language for web sites is JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
.
Utilizing JavaScript on the Document Object Model
Document Object Model
The Document Object Model is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Aspects of the DOM may be addressed and manipulated within the syntax of the programming language in use...
(DOM) leads to the method of Dynamic HTML
Dynamic HTML
Dynamic HTML, or DHTML, is an umbrella term for a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language , a client-side scripting language , a presentation definition language , and the Document Object Model.DHTML...
that allows dynamic creation and modification of a web page within the browser.
While client-side languages used in conjunction with forms are limited, they often can serve to do pre-validation
Data validation
In computer science, data validation is the process of ensuring that a program operates on clean, correct and useful data. It uses routines, often called "validation rules" or "check routines", that check for correctness, meaningfulness, and security of data that are input to the system...
of the form data and/or to prepare the form data to send to a server-side program.
Server-side
Server-side programs can do a vast assortment of tasks to create dynamic web sites — from authenticatingAuthentication
Authentication is the act of confirming the truth of an attribute of a datum or entity...
a login
Login
Login is the method whereby a user obtains access to a computer system.Login may also refer to:*Magazines:** LOGiN, published by Enterbrain** ;login:, published by USENIX* Login, Carmarthenshire, an hamlet in Carmarthenshire...
through, for example, Lightweight Directory Access Protocol
Lightweight Directory Access Protocol
The Lightweight Directory Access Protocol is an application protocol for accessing and maintaining distributed directory information services over an Internet Protocol network...
to retrieving and storing data in a database
Database
A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality , in a way that supports processes requiring this information...
to spell checking
Spell checker
In computing, a spell checker is an application program that flags words in a document that may not be spelled correctly. Spell checkers may be stand-alone capable of operating on a block of text, or as part of a larger application, such as a word processor, email client, electronic dictionary,...
to sending e-mail
E-mail
Electronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the...
— quite unlike client-side programs.
Some server-side program requests must pass through the web server
Web server
Web server can refer to either the hardware or the software that helps to deliver content that can be accessed through the Internet....
's Common Gateway Interface
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...
to execute
Execution (computers)
Execution in computer and software engineering is the process by which a computer or a virtual machine carries out the instructions of a computer program. The instructions in the program trigger sequences of simple actions on the executing machine...
the program to actually perform the tasks.
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
Web browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information resource is identified by a Uniform Resource Identifier and may be a web page, image, video, or other piece of content...
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:
- PHPPHPPHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
- PerlPerlPerl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
- ASPActive Server PagesActive Server Pages , also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically-generated Web pages. Initially released as an add-on to Internet Information Services via the Windows NT 4.0 Option Pack Active Server Pages (ASP), also known as Classic...
- ASP.NETASP.NETASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages ...
- Adobe ColdFusion
- JSPJavaServer PagesJavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...
- Ruby on RailsRuby on RailsRuby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
Some of the compiling languages commonly used:
- CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
- C++C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
- C#
- JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
- VBVisual BasicVisual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...
PHP
PHPPHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
is one very common language used for server-side languages and is one of the few languages created specifically for server-side programs.
A PHP script may:
- display the information on another page (ex: asking for a user's name and then displaying it on the web page)
- act as a logon interface
- post the data to a database (ex: mySQLMySQLMySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...
, an ASCIIASCIIThe American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
file, etc.) - store the information on the viewer's computer in an HTTP cookieHTTP cookieA cookie, also known as an HTTP cookie, web cookie, or browser cookie, is used for an origin website to send state information to a user's browser and for the browser to return the state information to the origin site...
- generate an e-mailE-mailElectronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the...
, either using the data or including said data in the e-mail's contents (possibly as an e-mail attachmentE-mail attachmentAn email attachment is a computer file sent along with an email message. One or more files can be attached to any email message, and be sent along with it to the recipient. This is typically used as a simple method to share documents and images...
)
The HTML form learns where to pass the data (from the action attribute of the form's HTML element
HTML element
An HTML element is an individual component of an HTML document. HTML documents are composed of a tree of HTML elements and other nodes, such as text nodes. Each element can have attributes specified. Elements can also have content, including other elements and text. HTML elements represent...
). 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 GET:
form.html
form_handler.php
In the above script the $_GET[
Perl
PerlPerl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
is another language often used for web development
Web development
Web development is a broad term for the work involved in developing a web site for the Internet or an intranet . This can include web design, web content development, client liaison, client-side/server-side scripting, web server and network security configuration, and e-commerce development...
. Perl scripts are traditionally used as Common Gateway Interface
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...
applications (CGIs). In fact, Perl is such a common way to write CGIs that the two are often confused. CGIs may be written in other languages than Perl (compatibility with multiple languages is a design goal of the CGI protocol) and there are other ways to make Perl scripts interoperate with a web server
Web server
Web server can refer to either the hardware or the software that helps to deliver content that can be accessed through the Internet....
than using CGI (such as FastCGI
FastCGI
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface ; FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page...
or Apache
Apache HTTP Server
The Apache HTTP Server, commonly referred to as Apache , is web server software notable for playing a key role in the initial growth of the World Wide Web. In 2009 it became the first web server software to surpass the 100 million website milestone...
's mod perl
Mod perl
mod_perl is an optional module for the Apache HTTP server. It embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request...
).
Perl CGIs were once a very common way to write web applications. But not being specifically designed for web development, Perl is now often viewed as less practical (both for developers and users) than specialized languages like PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
or ASP
Active Server Pages
Active Server Pages , also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically-generated Web pages. Initially released as an add-on to Internet Information Services via the Windows NT 4.0 Option Pack Active Server Pages (ASP), also known as Classic...
. This is especially true if Perl module
Perl module
A Perl module is a discrete component of software for the Perl programming language. Technically, it is a particular set of conventions for using Perl's package mechanism that has become universally adopted....
s would need to be installed on the web host or if wanting to use a non-CGI environment that might require extra configurations on the web server. Some web hosts also rely on interpreter-level sandboxing
Sandbox (computer security)
In computer security, a sandbox is a security mechanism for separating running programs. It is often used to execute untested code, or untrusted programs from unverified third-parties, suppliers, untrusted users and untrusted websites....
, which while possible with the Safe module, wouldn't be very practical and undoubtly break a lot of scripts considering common practices. Similar considerations might apply to other general-purpose scripting languages like Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
or Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
. For these reasons, a lot of cheap web hosts nowadays effectively only support PHP and web developers often seek compatibility with them.
A modern Perl 5 CGI using the standard CGI module with a form similar to the one above might look like:
form_handler.pl
Form-to-email scripts
Among the simplest and most commonly needed types of server-side script is that which simply emails the contents of a submitted form. This kind of script is frequently exploited by spammers, however, and many of the most popular form-to-email scripts in use are vulnerable to be hijacked for spamming purposes. One of the most popular scripts of this type was "FormMail.pl" made by Matt's Script Archive. Today, no version of this still frequently used script is considered secure.To avoid the confusion and difficulty of installing and using scripts, webmasters often use a free forms processing service to get their forms working.
Form builders
Many companies offer forms "as-a-Service". Usually, these companies give some kind of visual editor, reporting tools and infrastructure to create and host the forms, that can be embedded into webpages. Hosting companies such as BluehostBluehost
Bluehost is a shared hosting company owned by Endurance International Group. Bluehost was among those studied in the analysis of web-based hosting services in collaborative online learning programs...
and Doteasy
Doteasy
Doteasy Technology Inc. is a privately held web hosting service and domain name registration provider based in Burnaby, British Columbia, Canada. Doteasy is the sister company of In2Net Network...
provide templates to their clients as an add-on free service. Others offer free contact forms installable on any hosted website.
See also
- CAPTCHACAPTCHAA CAPTCHA is a type of challenge-response test used in computing as an attempt to ensure that the response is generated by a person. The process usually involves one computer asking a user to complete a simple test which the computer is able to generate and grade...
- LAMP (software bundle)LAMP (software bundle)LAMP is an acronym for a solution stack of free, open source software, referring to the first letters of Linux , Apache HTTP Server, MySQL and PHP , principal components to build a viable general purpose web server.The GNU project is advocating people to use the term "GLAMP" since what is known as...
- PostbackPostbackThe term postback has three meanings, depending on the context, one in relation to eCommerce as a web service, another in relation to web development, and one in relation to open-source software.-In eCommerce:...
- XFormsXFormsXForms is an XML format for the specification of a data processing model for XML data and user interface for the XML data, such as web forms...
- .ASPX FilesASP.NETASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages ...
External links
- Forms in HTML documents, the W3C's spec page for forms in HTML 4.
- Wikibooks: HyperText Markup Language/Forms
- How to create a HTML form with JavaScript client-side validation