Fast Form Processing
page 1 of 1
Published: 17 Oct 2003
Unedited - Community Contributed
Abstract
Classic ASP came with several tools that aren't used very much. One of these tools was the ProcessForm tool. This allowed you to process a form quickly and save the results as a text file.
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 8603/ 9

ASP Tip : Fast Form Processing

 

Introduction

Classic ASP came with several tools that aren't used very much. One of these tools was the ProcessForm tool. This allowed you to process a form quickly and save the results as a text file.

The Template

You first need a template, this file defines the layout of the output.

Form Information :<p>

Name : <%% Response.Write(Request.Form("fname") & " " & Request.Form("lname")) %%>

Save this file as 'template.asp'
Note the <%% and %%> instead of <% and %>

This template will be used to display for form results ie. print the first and last names of the person who entered in the form.

Processing the Form

On your form processing page you do this (the page that the form is posting/getting to) -

<%
Set utils = Server.CreateObject("MSWC.Tools")
utils.ProcessForm "data.html", "template.asp"
%>

This will create the file data.html and insert the form information based on the template.

Warning! The Tools component will not append to a file, it will overwrite it, to help stop this you can create something like this -

<%
Set utils = Server.CreateObject("MSWC.Tools")
filenum = utils.Random
utils.ProcessForm "data." & filenum & ".html , "template.asp"
%>

This will generate a random number (ie. data.512.html), this will help stop it from overwriting files. Another way would be to put a counter component as an application object and have it generate the number.



User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 9:50:43 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search