Hi,
I'm trying to change the value of a posted form element then write this to a CSV file.
I have a form of questions which posts over to a processing page. This processing page insert the values into the CSV file.
Some of the question lead on to other question e.g "if yes then what is your choice?".
My problem is when the user chooses a radio button but the next question means that they will not choose the radio button representing "if yes then what is your choice?".
When the processing page handles this, it just skips the value and inserts the remaining values into the CSV, as a result the CSV is a column short. Some how I need to but a blank value in the missed column
here is my processing code:
dim fsoObj, sFileName, objtextFile, fieldName, fieldValue
sFileName = server.mappath("swimming_results.csv")
set fsoObj = Server.CreateObject("Scripting.FileSystemObject")
set objtextFile = fsoObj.OpenTextFile(sFileName, 8)
For ix = 1 to Request.Form.Count
'********form elements processed here*
fieldName = Request.Form.Key(ix)
response.write(fieldName&ix)&": "
'*******form element values processed here*
fieldValue = fieldValue&Request.Form.Item(ix)&","
response.write(fieldValue)&"<br>"
Next
objTextFile.WriteLine(fieldValue)
objTextFile.Close
set objTextFile = nothing
set fsoObj = nothing
Please help!
I'm trying to change the value of a posted form element then write this to a CSV file.
I have a form of questions which posts over to a processing page. This processing page insert the values into the CSV file.
Some of the question lead on to other question e.g "if yes then what is your choice?".
My problem is when the user chooses a radio button but the next question means that they will not choose the radio button representing "if yes then what is your choice?".
When the processing page handles this, it just skips the value and inserts the remaining values into the CSV, as a result the CSV is a column short. Some how I need to but a blank value in the missed column
here is my processing code:
dim fsoObj, sFileName, objtextFile, fieldName, fieldValue
sFileName = server.mappath("swimming_results.csv")
set fsoObj = Server.CreateObject("Scripting.FileSystemObject")
set objtextFile = fsoObj.OpenTextFile(sFileName, 8)
For ix = 1 to Request.Form.Count
'********form elements processed here*
fieldName = Request.Form.Key(ix)
response.write(fieldName&ix)&": "
'*******form element values processed here*
fieldValue = fieldValue&Request.Form.Item(ix)&","
response.write(fieldValue)&"<br>"
Next
objTextFile.WriteLine(fieldValue)
objTextFile.Close
set objTextFile = nothing
set fsoObj = nothing
Please help!