SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP - Creating a comma delimited file from form

    Goal - To take a form with field such as name, email, comments and insert these into a text file - maybe as comma delimited. I would like this file to be continually written into. So multiple people can access this form and write there responses into the same file.

    I would like to do this in ASP.

  2. #2
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <%
    
    	strFile = Server.MapPath( "formdata.txt" )
    	boolHeader = True
    	For Each Item In Request.Form
    		strColumns = strColumns & Item & Chr(44)
    		strValues = strValues & Chr(34) & Request.Form( Item ) & Chr(34) & Chr(44)
    	Next
    	Set Sys = Server.CreateObject( "Scripting.FileSystemObject" )
    	If Sys.FileExists( strFile ) Then boolHeader = False
    	Set Txt = Sys.OpenTextFile( strFile, 8, True )
    	If boolHeader Then Txt.WriteLine( Left( strColumns, Len( strColumns ) - 1 ) )
    	Txt.WriteLine( Left( strValues, Len( strValues ) - 1 ) )
    	Txt.Close : Txt.Close
    	Set Sys = Nothing
    
    %>
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •