Processform.html
From Daily Data
Documentation for processform.pl
processform.pl is designed to allow you to create a template file, which is then processed by processform.pl. processform.pl will scan the template file for "variables" of the form $variablename$ and create an input template to request values for those variables from the user. Once the user has filled in all the blanks and pressed the "Submit" button, a form is displayed on the screen with all the blanks filled in. This form can then be either printed or saved.
- Installation
As long as processform.html is in a cgi directory (it is on Daily Data's server, located in /common-cgi/processform.html), all you need to do is create a directory for templates and create a configuration file in the directory above your web site document root named processform.conf. This file must be readable by the web server. The "normal" way of doing this is to create a directory on the same level as your htdocs directory named templates, then create the configuration file. The only contents of the file would be
templatedirectory=/home/http/dailydata/yourdomain/templates/
the last slash is required. - How to build a form
Create a standard HTML form but, everywhere you want to get information from the user, put in two dollar signs ($) and place some name between them. For example, if you wanted the user to put their name in you might use $yourname$ as the place holder. The variable names are case sensitive, so $YourName$ and $yourname$ are the different variables. You can even use blanks, though this may not work on some browsers. Most browsers would, however, correctly process a variable named $Your Name$. Note that when the input form comes up, the names of the fields are sorted in the order they appear in template file. So, the first variable defined in a template will be the first input field when the user is asked to fill in the blanks. Save the file you have created to your templates directory (generally, a directory named templates) and make sure the web server has the right to read it. - How to implement the form
To test the form, simply call the script passing the name of the template as a "parameter". A simple call to a form might be http://www.mydomain.com/common-cgi/processform.pl?templatename=mytemplate.template (replace mydomain.com with your domain, and mytemplate.template with the name of your template). You should see a form pop up that will have all of the variables you defined, waiting for input. This will not be the form you created. Now, fill in values for each of your variables and push the "Submit" button. Your form should now be displayed with all the blanks filled in. - Sample
Following is an example of a simple template that will get a person's name and address, then display a form letter on the screen. Note that the variable name $Enter Your Address$ may not work on some browsers.
<html>
<body>
<h1 align="left">A letter from $myname$</h1>
$myname$<br>
$Enter Your Address$<br><br>
Hi, this is a letter from $myname$. This is the end.<br>
Sincerely<br>
$MyName$
</body>
</html>

