FP2000: How to Call a Custom CGI Script With a FrontPage Form
ID: Q205691
|
The information in this article applies to:
*** WARNING **** *** WARNING **** *** WARNING **** *** WARNING ****
This article is information for Support Professionals. In no way is
this suggesting that you (the Support Professional) write, debug, interpret,
or configure a customer's CGI script/program, command interpreter, or Web
server. This article is meant to be educational. As a
support professional, your boundary for custom CGI is showing the customer how
to use the FrontPage interface for directing form output to the CGI
program.
*** WARNING **** *** WARNING **** *** WARNING **** *** WARNING ****
SUMMARY
This article explains the functionality of Common Gateway Interface (CGI)
and how to use a custom CGI script as a form handler.
NOTE: Not every script uses parameters in the same manner. For example,
a script may use specific methods to obtain parameters. If the customer is
unaware of these methods, direct the customer to the author of the script.
MORE INFORMATION
You will need the following script to complete the steps in this article:
http://www.speakeasy.org/~cgires/web2mail/#download
Overview
It is first important to understand what HTML forms and CGI scripts are.
Although they are very different, they work closely together. A form is a
web page with some additional markup tags that instruct a web browser how
to display the various form elements, such as check boxes, drop-down lists,
command buttons and text boxes. However, the web page itself does not
process the data, nor does the web server. In fact, the Web server does not
know what you want to do with the submitter's answers. A separate program
or script, must process that data, in whatever way you want.
HTML forms are just markup tags on a web page. The browser sends the
information gathered by the forms via HTTP to the server. The server
uses CGI to pass the values to the script or program.
NOTE: CGI programs and scripts can be written in a variety of different
languages, such as PERL, TCL, C, and shell scripts. Regardless of which
language is used, the FrontPage interface is the same.
When the submitter submits a form, the browser bundles the answers and
sends them to the web server. The Web server passes this information to
your script for processing. The CGI script knows how to read that bundle of
data. Here are some important points about CGI:
- The web page itself does not process the data entered on the form.
Neither does the web server. The script instructs the Web server to
send the data to it. It speaks the CGI language that the server uses
to send the data. You need both the web page and the script.
- For security reasons, many web servers will not execute a file (even a
script or program with the right permissions) unless it is in a
designated directory or has a designated file name extension.
This is configured by the server administrator.
NOTE: The customer MUST already know the following information:
- Is the web server configured for CGI?
- What directory do you put the script in?
- What extension is used by the script (for example, .cgi or .pl)
- Do they have the correct permissions to use CGI and to execute scripts?
- Where is the HTTP location of the script? This is important when
you use a CGI script as a Form handler.
If the customer does not know this information, refer them to the
server administrator, Internet Service Provider, or Web Presence
Provider.
- What are the parameters you want to pass to the script? And what method
do you want to use (for example, QueryStrings vs. hidden form fields)?
- What language do you want to use for the CGI (for example, PERL 4/5, C,
or TCL)?
If the customer does not know this information, refer them to the
author of the script. If the customer is the author of the script,
refer them to Developer Consulting for $195 per hour.
Installing a CGI Script
Each server is configured a little differently. The customer should ask
their system administrator if CGI is enabled on the server. If the customer
is the system administrator, he should read the documentation to determine
this. The customer should also determine if user-installed CGI scripts are
permitted. Some systems permit only the administrator to install CGI
scripts. Then you will typically need to find out the following:
- What is the path to the command interpreter? (This information is needed
for the first line of a CGI script NOT for the HTML.)
- Where do you need to place the script?
- What do you need to call the script?
- What permissions do you need to set for the script and does the script
need to write to some files?
- How do you set those file permissions?
Building a Form in FrontPage
- Create a new page in FrontPage.
- On the Insert menu, point to Form, and click One-Line Text Box.
- Insert three more text boxes on the page.
You should now have four text boxes. You can now incorporate a CGI Form
handler to use the FrontPage generated form.
- Right-click the form and click Form Properties on the menu that appears.
- From the Send To Other list, click "Custom ISAPI, NSAPI, CGI or ASP
Script."
- Click Options. In the Options dialog box, do the following:
- In the Action box, type the following URL:
http://www.speakeasy.org/~cgires/perl_form.cgi
- In the Method box, click Post.
- Click OK.
- Click OK.
- Save the page as an HTML page.
- On the File menu, click Preview In Browser.
NOTE: After you click Submit on the form, a page called A Web Form
Analyzer will appear. This is the results page of the CGI script.
REFERENCES
For additional information and sample CGI scripts, please see the following
World Wide Web site:
http://www.speakeasy.org/~cgires/index.html
Additional query words:
form handler 98 2000RTMPartner
Keywords :
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 1, 1999