The REQUIRE statements makes sure that a particular field was filled in on the form. In this case it is the NAME field. Both the word 'REQUIRE' and the name of the field must be capitalized. If the NAME field was filled out then it goes to the next step, but if it was left blank, then the HTML following the REQUIRE statement is sent to the user. The REQUIRE command begins a section that continues until the program hits a "|" command. Please make sure you put your mouse over the "|" to see what it does.
The vertical line "|" tells the program that this is the end of this section. In this case, the end of the REQUIRE NAME section. If the NAME field was filled out, then the program skips down to here to see what to do next. If it wasn't then it comes to here and stops. It is very important that you put on of these at the end of each section. It must also be all alone on a line.
This REQUIRE statement works the same as the one above, only it requires the DEPT field. Please see REQUIRE NAME for more details. Again, the section must be ended with a "|".
This line ends the REQUIRE DEPT section. Please see the "|" at the end of REQUIRE NAME for more details.
This REQUIRE statement works the same as the one above, only it requires the EMAIL field. Please see REQUIRE NAME for more details. Again, the section must be ended with a "|".
This line ends the REQUIRE EMAIL section. Please see the "|" at the end of REQUIRE NAME for more details.
The MAIL-TO tag sends the following section as email to one or more addresses. Because it is after the REQUIRE commands, it will only happen if they have been met. In this case only one copy is sent to millerca@jmu.edu If you wanted to send it to more then one person, you would separate the addresses with commas, but without spaces. After the email address, you can add a subject line that will be used for the email. In this case the subject of the email will be "Sample doform output".
These are the fields that will be sent. These names must match the 'name' property of the form fields. They must also each be contained in vertical lines as you see here. If you do not use the lines, they will be treated as text, and not as a field name. They will be included in the email exactly as you set them up here.
This line ends the MAIL-TO section. The program will only send mail containing the items between the MAIL-TO command and this line.
The RESPOND command is used to send a "thank you" page to the user. This page will be displayed if all required fields are filled out. It can contain any vaild HTML.
This filed "NAME" will have the value that was entered on the form replace it before the page is returned to the user. That way it can confirm that you got the right information.
This | ends the RESPOND section. It lets the program know where to stop. For more information, see the "|" at the end of the REQUIRE NAME section.
REQUIRE NAME<html>
<head>
<title>Sorry.</title>
</head>
<body>
I'm sorry, but we really do need to know who you are for this to do us anygood. Please go back and try again.
</body>
</html>
|
REQUIRE DEPT
<html>
<head>
<title>Sorry.</title>
</head>
<body>
I realize it shouldn't matter, but we would like to know what department you are with.
</body>
</html>
|
REQUIRE EMAIL
<html>
<head>
<title>Sorry.</title>
</head>
<body>
If we don't have your email address, we can't get in touch with you.
</body>
</html>
|
MAIL-TO millerca@jmu.edu Sample doform output
|NAME<30|
|DEPT<20|
|EMAIL<20|
|REASON<10|
|TRIED<10|
|
RESPOND
<html>
<head>
<title>Thanks for trying this out.</title>
</head>
<body>
Thanks |NAME|, for taking the time to try this sample form. A note has been sent to Carol Miller
letting her know that you filled out the form. It also includes the rest of
the info you put into it.
Would you like to <ahref="http://www.jmu.edu/computing/tutorials/doform/formsource.html">seehow the form was made?</a> Or perhaps you are more
interested in <ahref="http://www.jmu.edu/computing/tutorials/doform/config.html">whatthe configuration file</a> looks like. <br>
<ahref="http://www.jmu.edu/computing/tutorials/doform/index.html">Clickhere to go back to the introduction.</a>
</body>
</html>
|
| << Back to Tutorial List |


