Appendix J Introduction to (Web site translator) HyperText Markup Language 4:

Appendix J Introduction to HyperText Markup Language 4: Part 2 1405 The form begins on line 21

with the form element. The method attribute indicates the way the information gathered in the form will be sent to the Web server for processing. Use method = “post” in a form that causes changes to server data, for example when updating a database. The form data will be sent to the server as an environment variable, which scripts are able to access. The other possible value, method = “get”, should be used when your form does not cause any changes in server-side data, for example when making a database request. The form data from method = “get” is appended to the end of the URL (for example, /cgibin/ formmail?name=bob&order=5). Also be aware that method=”get” is limited to standard characters and cannot submit any special characters. A Web server is a machine that runs a software package like Microsoft s PWS (Personal Web Server), Microsoft s IIS (Internet Information Server) or Apache. Web servers handle browser requests. When a browser requests a page or file somewhere on a server, the server processes the request and returns an answer to the browser. In this example, the data from the form goes to a CGI (Common Gateway Interface) script, which is a means of interfacing an HTML page with a script (i.e., a program) written in Perl, C, Tcl or other languages. The script then handles the data fed to it by the server and typically returns some information for the user. The action attribute in the form tag is the URL for this script; in this case, it is a simple script that emails form data to an address. Most Internet Service Providers (ISPs) will have a script like this on their site, so you can ask your system administrator how to set up your HTML to use the script correctly. For this particular script, there are several pieces of information (not seen by the user) needed in the form. Lines 24 31 specify this information using hidden input elements. The input element is common in forms and always requires the type attribute. Two other attributes are name, which provides a unique identifier for the input element, and value, which indicates the value that the input element sends to the server upon submission. As shown above, hidden inputs always have the attribute type = “hidden”. The three hidden inputs shown are typical for this kind of CGI script: An email address to which the data will be sent, the subject line of the email and a URL to which the user is redirected after submitting the form. Good Programming Practice J.1 Place hidden input elements in the beginning of a form, right after the opening
tag. This makes these elements easier to find and identify. The usage of an input element is defined by the value of its type attribute. We introduce another of these options in lines 35 37:
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Leave a Reply