Creating Form Buttons

Up to now, all of your form elements have been input fields of one kind or another. Another type of form field is one that performs an action when activated-as a button does when the user clicks it. Buttons can be used to run programs, submit forms, or reset the form to its original state. To create a button to submit the form to the CGI script, enter the following tag:

<INPUT TYPE=SUBMIT VALUE="text">

where the VALUE property defines the text that appears on the button and specifies the value that is sent to the CGI script to indicate which button on the form has been clicked.

To create a button to cancel or reset the appearance of your form, use the TYPE property shown in the following tag:

<INPUT TYPE=RESET>

To create a button to perform an action within the Web page by running a program or script, use the following tag:

<INPUT TYPE=BUTTON>

Return to your text editor with the contestform.html file. Directly above the </TABLE> tag, insert the following tags:

<TR>

<TD COLSPAN=2 ALIGN=CENTER>

<INPUT TYPE=SUBMIT VALUE="Send Contest Form">

<INPUT TYPE=RESET VALUE="Cancel">

</TD>

</TR>

Save your changes to the file, and then reload the file in your Web browser. View your form in both Explorer and Netscape to see the difference of how each browser handles the information. Test the Cancel button by entering test values into the form and then clicking the Cancel button. The form should be returned to its initial state.