I am struggling to come up with a way to save a forms'
results, to a text file, but the name of the text file
comes from the input of a user name on another forms...

ex. john doe enters pg1 & enters his name in a space on
the page (form) . this links him to the next page,
pge_form. I need the results of page_form to be named
johndoe.txt

Thank you very much for any help at all...

Re: asp script for forms result by jeff

jeff
Tue Jun 22 20:30:01 CDT 2004

On Tue, 22 Jun 2004 15:45:11 -0700, "shinyd"
<anonymous@discussions.microsoft.com> wrote:

>I am struggling to come up with a way to save a forms'
>results, to a text file, but the name of the text file
>comes from the input of a user name on another forms...
>
>ex. john doe enters pg1 & enters his name in a space on
>the page (form) . this links him to the next page,
>pge_form. I need the results of page_form to be named
>johndoe.txt

Where is your problem? Is it passing the results of the first form
through the second? Or creating a new named text file? And why must
it be two forms? Using POST or GET?

Jeff

Re: asp script for forms result by shinyd

shinyd
Tue Jun 22 22:15:54 CDT 2004

I can actually have it all on 1 page... the problem is the
end result with the naming of the text file .... Should
create an individual file named %varaible%.txt

Thanks
Dave

>-----Original Message-----
>On Tue, 22 Jun 2004 15:45:11 -0700, "shinyd"
><anonymous@discussions.microsoft.com> wrote:
>
>>I am struggling to come up with a way to save a forms'
>>results, to a text file, but the name of the text file
>>comes from the input of a user name on another forms...
>>
>>ex. john doe enters pg1 & enters his name in a space on
>>the page (form) . this links him to the next page,
>>pge_form. I need the results of page_form to be named
>>johndoe.txt
>
>Where is your problem? Is it passing the results of the
first form
>through the second? Or creating a new named text file?
And why must
>it be two forms? Using POST or GET?
>
>Jeff
>.
>

Re: asp script for forms result by Scott

Scott
Wed Jun 23 09:34:10 CDT 2004

"shinyd" <anonymous@discussions.microsoft.com> wrote in
news:1fbb101c458d0$6545eda0$a601280a@phx.gbl:

> I can actually have it all on 1 page... the problem is the
> end result with the naming of the text file .... Should
> create an individual file named %varaible%.txt

Page 1:

<form method=post action="process.asp">
Name: <input type=text id=UserName><br>
Favorite Color: <input type=text id=FavColor><br>
Name a scary animal: <input type=text id=ScaryAnimal><br>
<input type=submit>
</form>

Page 2:

<%
If Len(Request.Form("UserName")) > 0 Then
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TStream = FSO.CreateTextFile("C:\Path\You\Desire\" & Request.Form
("UserName") & ".txt")
For Each Item in Request.Form
If Item <> "UserName" Then
TStream.Write Item & ": " & Request.Form(Item)
End If
Next
TStream.Close
End If
%>

Note: this code is untested, and is off-the-top-of-my-head, so there may
be some bugs. Note also that there is virtually no error-trapping to
make sure that UserName is a valid filename value... if somebody were to
type in "?" (for example) the code would break.

I'll leave the error-trapping up to you.

-Scott

Re: asp script for forms result by jeff

jeff
Wed Jun 23 10:22:10 CDT 2004

On Tue, 22 Jun 2004 20:15:54 -0700, "shinyd"
<anonymous@discussions.microsoft.com> wrote:

>I can actually have it all on 1 page... the problem is the
>end result with the naming of the text file .... Should
>create an individual file named %varaible%.txt

You mean like:

strName = Request.Form("Name")
FileName = strName & ".txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set TextFile = filesys.CreateTextFile(FileName, True)
TextFile.WriteLine("This is a line of text")
TextFile.Close

Jeff



>Thanks
>Dave
>
>>-----Original Message-----
>>On Tue, 22 Jun 2004 15:45:11 -0700, "shinyd"
>><anonymous@discussions.microsoft.com> wrote:
>>
>>>I am struggling to come up with a way to save a forms'
>>>results, to a text file, but the name of the text file
>>>comes from the input of a user name on another forms...
>>>
>>>ex. john doe enters pg1 & enters his name in a space on
>>>the page (form) . this links him to the next page,
>>>pge_form. I need the results of page_form to be named
>>>johndoe.txt
>>
>>Where is your problem? Is it passing the results of the
>first form
>>through the second? Or creating a new named text file?
>And why must
>>it be two forms? Using POST or GET?
>>
>>Jeff
>>.
>>