To have your emails from eform.cgi formatted, you have to do just two extra steps:
The person's name is %%NAME and their age is %%AGE ...
The double percent sign marks a place where an input will be substituted and it's followed by the name of the input. Of course, this template would only make sense for a form with inputs named NAME and AGE. (The matching is not case sensitive.)
<input type="hidden"
name="template"
value="my_template.txt">
Here's a version of the example form using this template.
Try the example form that uses templates. Next, using "view source," find out the name of the template file. Then, click here to see the template file . You can save the file if you like, but it's not necessary.
Here is the solution to Exercise 2
Using the template feature opens you up to a new set of possible errors. This section discusses what some of them are and possible causes and cures.
You may get an error message that says:
Error: Unused parametersThe following parameters were in your form, but were not used by the template file:
input 1 value 1 input 2 value 2
This happens when you're using a template file and eform.cgi thinks your template file is incomplete: it's not using up all the inputs. The purpose of this is so that the form author doesn't accidentally forget some important data. The error can be caused by several things:
The solution to this is to name your inputs without the prefix property. For example, you could name the first input above "username" and the error would be avoided.
© Computer Science 110 Staff
This work is licensed under a Creative Commons License
Date Modified:
Wednesday, 24-Jan-2007 01:27:13 EST