An Overview of HTML Forms

Revision as of 18:11, 5 June 2007 by Neil (Talk | contribs) (New page: A large part of developing a web based application involves handling interaction with user via their web browsers. Oneof teh most common tasks in this area of web development involves pres...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Revision as of 18:11, 5 June 2007 by Neil (Talk | contribs) (New page: A large part of developing a web based application involves handling interaction with user via their web browsers. Oneof teh most common tasks in this area of web development involves pres...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A large part of developing a web based application involves handling interaction with user via their web browsers. Oneof teh most common tasks in this area of web development involves presenting the user with forms to collect information, and the processing that information.

Web forms are typically created using the HTNML form element toegterh with various user interface objects (such as text fields, toggle buttons and push buttons).

Before exploring the interaction between PHP and the HTNL form elements it is first import to have a basic understanding of HTMl forms. The purpose of this chapter, therefore is to provide this basic grounding before moving on to the more PHP specific areas of building form. If you are already familiar with HTML forms feel free to move on to Building Forms with PHP.

Creating HTML Forms

HTML forms are used to collect data from users. Users essential enter data into forms by filling text fields, selecting toggles and making choices from selection objects. When the user has filled in the data it is transmitted to the server for processing.

HTML forms are specified using the <form> element. The form element contains an attribute which specifies the script on the server to which the gathered data is to be sent. Data can be sent to the seerv using one of two methods, GET or POST. With GET, all the data is passed to the server embedded in the URL. POST is typically used for larger volumes of data.

The various <input> elements are then specified within the body of the <form>.

With this information in mind we can create a simple HTML form containing a text field input as follows:

<html>
<head>
<title>Simple HTML Form</title>
</head>
<body>
<form action="submit.php" method="post">
<input type="text" name="customerName" value="Text here" />
</form>
</body>
</html>