Forms make web sites interactive by allowing visitors to enter information in a structured way. The information can then be placed into databases or e-mailed to you. Forms SyntaxForms are created by the insertion of special tags into ordinary XHTML pages. You can use a WYSIWYG editor that can do forms, or you can create the tags and insert them into the pages yourself. Because there are other web sites that teach the syntax of the tags, this page does not discuss syntax. Spend time studying the references given below.
Server-Side Processing Of FormsInformation is entered into a form while the form is displayed by a browser. The information is transferred to the web server hosting the web page containing the form, and the server passes the information to a designated program or script for processing. The particular program or script used depends on the web site providing the server. The XHTML <form> element begins a form and gives the name of the program or script that is to be used to process the data from the form. For example, this element might look like the following.
That element should be on one line. Notice that the tag has an action argument that consists of the URL of a cgi program or script to process the information from the form. Because the programs and scripts used to process forms are provided by the web site hosting the web server, you will need to talk with the webmaster of the web site hosting your site to find out about the programs, scripts, and exact syntax that you use. Avoid SpamIf you use a form to allow visitors to send their email address to you (e.g. for an email list for your site), do not put in the email a cc back to your visitors. Spammers may be able to put many email addresses in the field for the visitor's address, and the cc will send the email to all of the email addresses (I know about this because I learned it the hard way). Whether or not spammers will be able to do this in your case will depend on how your server processes the email request. Similarly, you may have the same problem if you use a form to send email to a specified address, such as a form to recommend your site to others. The Links page of this site has links to sites that have free CGI scripts available.
|