Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with Text Files

Status
Not open for further replies.

Danielvb

Programmer
Oct 8, 2002
34
US
Hello people

Please I need your help. I have two pages in ASP Iselect.asp and Idisplay.asp.

The first page (Iselect.asp) the user select from the drop downbox a state and once he/she hit the submit bottom the paramenters passes to the other page (Idisplay.asp).

The second page (Idisplay.asp)receives the paramenters and look for the file in a ditrectory (c:\STATES\) that contains 50 text files using the name of the 50 states of the USA.

The second page (Idisplay.asp) search for the file and display the information in the same page (Idisplay.asp).

Question:

How can I accomplish the search for the file and display the information in the browser without loosing the alingment of the text file.

Thanks in advance for your help.

Daniel
Hollywood, FL
 
You might try wrapping the text from the file in preformatting tags.

<pre>
<%
response.write strFromTheTextFile
%>
</pre>
 
if i get what you want...

whichfile=request(&quot;state&quot;) & &quot;.htm&quot;
Call ReadDisplayFile(whichfile)

SUB ReadDisplayFile(FileToRead)
whichfile=server.mappath(FileToRead)
Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
end sub

amend 'server.mappath(FileToRead)' to the directory where the files are stored. Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Thanks :) You are the best guys

Thanks for your help

Daniel
Hollywood,FL


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top