MS FrontPage

Saving Form Results

You've got yourself a form! A visitor can open the page you created, enter the information you need, and click Submit. But then what happens?

Your form won't do you any good unless you tell FrontPage how you want to receive the information it gathers. You can save results in a text file, in an email message that you have the server send to you, or shoot the results into a database.

You set all these options within the Form Properties dialog box (see Figure 15-8). To open it, right-click inside the form, and then select Form Properties.

Figure 15-8. The Form Properties dialog box lets you specify what you want to do with the data your forms have collected. Set additional details for each selection shown here by clicking Options, in the lower-left corner.

Saving Results to a File

If you want to store results in a flexible format, consider saving the results in a file. When you do so, FrontPage takes your data, creates a new file, and then plunks your data in it. The resulting file can be a simple HTML file or a more versatile text file (see the box "Data in a Text File"). Once FrontPage creates this file, it appends data gleaned from additional form submissions to the file's contents.

Data in a Text File

Saving data in a text file is a more flexible option than saving it in an HTML file. For starters, a text file won't include any extra gobbledygook like HTML tags. If it's just data you're looking for, stick with a text file. In fact, you should use an HTML file only if you want to display the results on your site.

Many data-gathering wizards regularly use text files (with file endings like .txt or .csv) to hold data. As long as the data in these files follows certain predictable rules (like commas appearing between each field and a paragraph return appearing between each record, for instance), a program can easily accept the text data and transform it into an Access or SQL database, or an Excel spreadsheet.

To save your data in a file, select the "Send to" radio button in the Form Properties dialog box. Next, enter a name for you file, including its location:

  • If you want to store the file within your Web site, enter a relative URL (Understanding Hyperlinks), including a file name like contactform_results.csv.

  • If you want to store the file outside your sitesay, on your company's data server instead of the Web server that your site's onenter the path. You can enter this in UNC (Universal Naming Convention) format, like \\dataserver\ siteresults\form_results.csv or use a drive-letter path, like N:\siteresults\form_ results.csv.

  • If you want form results to be private, save them to a .txt or .csv file in your site's _private folder. FrontPage hides this folder from visitors, but it's not super secure. If form data is confidential or sensitive, then save results in a password protected area in your site or in another location. (To learn how to restrict access to part of your site, see "Securing a Subsite" on Letting FrontPage Create Your Form.)

  • If you want your results to be public, save the results into an HTML file (not a text file) and store it in a file where your visitors can find it (not the _private folder, in other words).


Turn on the "Include field names" checkbox. Without it, you'll see only a viewer's entry values and may have no idea what field names they belong to.

Specifying file format and type

To choose the kind of file you want to create when saving your form data, click the Options button on the lower-left corner of the Form Properties dialog box. Here you can specify a file format by selecting one of the following from the drop-down menu:

  • XML. The server pipes data into an XML file, which uses tags to separate data elements. You can output to XML only if your Web server is running Share-Point services.

  • HTML. The server saves data onto a Web page and applies no special formatting.

  • HTML Definition List. As in the preceding item, data appears on a Web page, but displays in definition list style (Creating Lists), in which field names are matched with values that a visitor has added.

  • HTML Bulleted List. Data appears on a Web page in a regular bulleted list (Creating Lists).

  • Formatted text within HTML. Data appears in HTML-formatted text format (which looks like typewriter textsee Formatting Paragraph).


    Whenever you choose to output to an HTML file, FrontPage activates the "Latest results at end" checkbox below the File format field. When you send data results to a file, the Web server just appends new data at the bottom of the file, below data you've already collected. If you turn this checkbox off, the server adds new results to the top of the page. (In a text file, data always gets appended at the end of the file, no matter what.)
  • Formatted Text. Select this if you want to output data in a text file that the server formats for easy reading.

  • Text database using comma as a separator. Data goes in a .csv text file where values are separated by commas.

  • Text database using tab as a separator. Data goes in a .txt text file where values are separated by tabs.

  • Text database using space as a separator. Data goes in a .txt text file where values are separated by spaces.

Outputting to a second file

FrontPage lets you have your cake and eat it too. If you enter another file in the Optional Second File field, you can simultaneously send results to an alternate file. This means that you can gather text in a useful text format while also plunking it into an HTML file that visitors can see on your site, if you want.

Saving Results to Email

You can also have your form results delivered right to your inbox or into a mailbox that you've specially set up to receive them. If you're trying to decide whether to send results to a file or to an email, good news: it's not an either/or decision. You can do bothreceive an email and output data to a file, as described above.

To start setting up an email format output, open the Form Properties dialog box (right-click the form and select Form Properties) and click Send To. You don't need to enter an email address right away. Instead, click Options, and then click the E-mail Results tab (see Figure 15-9).

Figure 15-9. Specify how you want to receive your email results within this dialog box. FrontPage includes options for adding a subject line (which can draw from a field on your form) and setting up an email address to which you can reply automatically (this can also be extracted from a viewer's form entrysee step 5 in the instructions for setting up email format output).

Then, follow these steps:

  1. Enter the email address to which you'll route form results.

    Generally, this can be any address you want, but some Web hosts limit your options to email addresses within your site's domain. For example, if your domain is www.myfabuloussite.com, you'd only be able to send to email addresses that end in "@myfabuloussite.com"like [email protected]. Check with your Web hosting company, or run a quick test.

  2. Select an email format.

    FrontPage automatically sets this field to "Formatted text," which is a good, easy-to-read option. However, this drop-down list includes all the choices that FrontPage offers for file formatting (which are listed in the previous section).

  3. Make sure the "Include field names" checkbox is turned on.

    This way, field names will be sent with values so you know what questions visitors are responding to.

  4. Set a subject line.

    When your email arrives, it needs to have a subject line. You have two options here:

    • Create your own subject line. For example, you might want to do this if you're sending support emails into your everyday mailbox. This way you'll know it's not a regular message, but a support request.

    • Pull out a value entered by the visitor in one of your form fields and use it as the email subject line. Say your support request form has a text box where viewers enter a brief description of their problem. If you make that field the subject line, you'll get a head start understanding what they're writing about.

  5. Set a reply-to line.

    Here, you'll set up a recipient for any replies you make to the data results emails you receive. You can enter a specific address in this field, but that won't do you much good unless you route all your emails to a specific person for handling. On the other hand, say you want your response to go to the person who submitted the form. No problemas long as you've had your visitor enter his email address in one of your form fields. If that's the case, turn on the "Form field name" checkbox and enter the name of that field below.

  6. Click OK.

    The email address you entered now appears in the Form Properties dialog box as the "send to" email address.


Email addresses you enter in the Form Properties dialog box end up buried within the page's regular HTML. This means that they're sitting ducks for the email address harvesters that spammers send out across the Web (see Fine Tuning Hyperlink Properties for more on keeping your email address out of the hands of spammers).

Saving Results in a Database

FrontPage makes it easy for even database know-nothings to plug information from forms into a database. In fact, the program can even create one for you, based on your form fields.

Working with Databases covers database fundamentals. Once you know the basics, you can learn how to send your form results to a database and understand how FrontPage works with databases.

Other Output Options

You have some additional options for handling data collected in your form. If you click "Send to Other" in the Form Properties dialog box, FrontPage gives you three choices, described in the following sections.

Outputting to a custom script

The simple form handling options that FrontPage offers might not be enough for you. You may want your forms to work a little more magic. For example, if you want to send your form results to many email addresses or have your confirmation page total figures a visitor's entered in your form, you'll need to use a custom form-handling script. Where would you get such a script? Well, you need to write it or befriend someone who can. You can also check with your Web host to see if they offer any scripts to process form results.

A custom form-handling script steps in and does the job that FrontPage does when you output your data to a file or email. Custom scripts offer the most flexibility of all output options and are necessary for forms that handle complex data. Scripts also enable you to react to myriad visitor actions and customize result outputs to suit your needs.

To use a script to handle form results:

  1. Click "Send to other" then select "Custom ISAPI, NSAPI, CGI or ASP Script" from the drop-down menu.

    This selection shows the types of scripts FrontPage allows. Your choices are: ISAPI (Internet Server Application Programming Interface), NSAPI (Netscape Server Application Programming Interface), CGI (Common Gateway Interface), or ASP (Active Server Pages). After you make a selection, FrontPage can tell what type of script you're using when you link to one of these file types in the next step.

  2. Click Options on the lower left. A dialog box for Custom Form Handler options displays (see Figure 15-10).

    Figure 15-10. This dialog box lets you link your form to a custom script to handle results. However, you can decorate your form from here, too. If you click Style, you can use CSS (Styles an Introduction) to format fonts, borders, or shading in your form.

  3. Set the following options:

    • Action. Here you'll specify the URL of your script.

    • Method. Your selection here depends upon the kind of script you're using. You've got two choices. POST is the more common and more flexible option whereby the browser first contacts the form program on the server, then sends the data to it. This method is what a browser does automatically, unless instructed otherwise. It's more secure, because all the data is passed behind the scenes. In the GET method, the browser sends data as part of the URL. Form field names and values that a visitor enters are all appended to the page's URL. For example, say a visitor types the term "platypus" in a search form. The URL that search would return looks something like: http://wwwmysite.com/cgi-bin/search.cgi?term=platypus. The search.cgi part is the special script that's handling the form. A question mark separates the main URL from the part of it that shows data. "Term" is the name of the search field. In this example, the visitor's filled out only one field, if a form has many fields, the URL can grow quite large. Since a URL can't be longer than 255 characters, you can understand how limited this method is.

    • Encoding type. This sets some communication parameters for the form data. You can leave this blank, which means that you're sending data from ordinary form elements (no value here is the same as entering "application/x-www-form-urlencoded," but why should you tax your fingers typing that?). The only time this setting would be different is if you have an upload element (which lets users upload a file to your site) in your form. In that case, FrontPage automatically enters the phrase "multipart/form-data" for you.

  4. Save your settings.

    Click OK to save your form handler settings and then click OK in the Form Properties dialog box.

Registration form handler

If you've set up site registration (see Letting FrontPage Create Your Form, later this tutorial), FrontPage uses this selection to handle user name and password entries.

Discussion form handler

If you've set up a discussion site (see Letting FrontPage Create Your Form, later this tutorial), FrontPage uses this selection to handle all discussion entries that visitors submit.