Forms allow you to collect information
from users, process that information, and return meaningful results. A
form is a special HTML tag that contains other tags. These other tags describe
the type of information you want to collect. All form data must be processed
on a web server by a seperate program, usually a CGI program or an ASP
program. This processing program then returns information to the user.
Counters
Counters do just what their name implies: the give you a count of how many times a page has been accessed. Althought they were popular in the early '90s, they are no longer widely used because they do not provide you detailed information about your web site.
Counters provide only a summary count of page hits; they do not give you information about where your visitors were coming from, what browsers on what operating systems they were using, how many people accessed your page, where they connected from, and how long they stayed there. For this kind of information, you need a web log analysis tool. Web servers keep detailed logs for all page accesses and this information can now be presented in a visual format. Click here for an example of the web log analysis for the TIFLE site. .
Counters can be used to get a rough overview of your web site usage. PSU's personal server, www.personal.psu.edu, provides a counter script. To add a counter to your personal server web page, open the page in an HTML editor, preferably one that lets you insert HTML code directly, such as Dreamweaver. To choose the style of counter you want, go to this page to select a counter style. Copy the HTML code from the Usage column of the table. In Dreamweaver, select Window > HTML Inspector, paste the counter's HTML code into your document and close the HTML Inspector. Save your file and publish it to the personal server.
More information about the personal
server's counter script is available here.
Formmail script
If you want the results of your forms emailed back to you, the personal server provides a script you can use. You don't even have to store your pages on the personal server for this to work! Just paste this code into your web page.
<FORM ACTION="http://www.personal.psu.edu/cgi-bin/formmail.cgi"
METHOD="POST">
This creates a form and sets it to
call the formmail script.
<INPUT TYPE="hidden" NAME="recipient"
VALUE="your_email_address">
This tells the form where to mail the
results.
<INPUT TYPE="hidden" NAME="subject"
VALUE="subject_of_the_email">
This tells the form what to put in
the subject line of the email.
<INPUT TYPE="hidden" NAME="return_link_url"
VALUE="url_of_the_return_link">
This tells the form what web page to
display after the user submits the form.
Javascript
Javascript is a simplified but powerful programming language which can be embedded into web pages. Javascript can be used to validate form entries before sending the data to a server, to change images on a page, to display random quotes or to perform any task whcih you need to define programtically. Dreamweaver includes several built-in Javascript "behaviors," so you don't have to do any coding. To insert behaviors, select Window > Behaviors.
Behaviors must be attached to an object. Select the desired object, and click on the + button on the behavior palette. Behaviors are "riggered" by an event handler, a condition for execution. This can be moving a mouse over or off of an element, clicking the mouse or loading the page. Choose an event handler for the behavior and a behavior. For example, if you highligh an image, select the onMouseOver event handler and the SwapImage()behavior to change the image when the mouse is over the image. Common eventhandlers include onClick, onDoubleClick, onMouseOver, and onMouseOut. Note: not all behaviors are available with all event handlers, and not all behaviors will work on all broswers.
To validate a form in Dreamweaver, select the form, open the Behaviors palette, choose the onSubmit event handler and the ValidateForm behavior. This will ensure that the form meets your criteria before being sent to the server.