Useful Resources
syllabus | schedule | exercises | assignments | class notes | resources | students | ARTC courses
Form Attributes

FORM ATTRIBUTES

Ex: <FORM action="processForm.php" method="post">

action (required)
This attribute tells the browser where to go upon submission (and where to submit the data to).

NOTE: The only time you would leave out this attribute is if you were using an onClick or other JavaScript method to access the form.

method (required)
This can be equal to either GET or POST. This is the method that the browser will use to communicate to the Web server and send the form information.

GET - the default, this method puts the form information in the URL after a question mark.
EX: http://www.server.com/cgi-bin/test.pl?name=value

POST - this method sends the form information as a data block to the server through HTTP protocols. You will not see the information in the URL.

onsubmit
If you want to perform JavaScript validation on your form, then you need to have a JavaScript call within the form tag. The onSubmit attribute tells the browser to complete a JavaScript script before submitting the form to the server.

Example: <form action="../cgi-bin/mycgi.pl" name="testform" onSubmit="return TestDataCheck()">

[BACK to RESOURCES]