-
Saving Form to CSV
I have created a simple Form (Name, Address, Age, email address) in dreamweaver cs3 which uses ASP to show the results on a separate page.
What I am after is a simple script that will allow me to save the results of the form to a txt or csv file. I am happy to have separate files for each entry but woudl prefer them to be added to the same file.
Hoping someone could help here and hold my hand through it thanks - assuming it needs a script
-
this should get you started [untested]
Code:
<%
dim oFSO, oFile
dim strOutput
set oFSO = server.createobject ("scripting.filesystemobject")
set oFile = oFSO.createtextfile("D:\websites\" & FileName,true)
for x = 1 to request.form.count()
strOutput = strOutput & trim(request.form.item(x)) & ","
'remove the last comma from the line before continuing
strOutput = left(strOutput,len(strOutput)-1)
oFile.writeline strOutput
next
oFile.close
set oFile = nothing
set oFSO = nothing
%>