<% CounterFile = Server.MapPath ("..\survey") & "\counter.txt" strFilename = Server.MapPath ("..\survey") & "\survey.txt" Dim AryData() '------------------------------------------------------------------' '------------------------------------------------------------------' Sub Save_Results() 'Response.Write strFilename Set objFSO = CreateObject("Scripting.FileSystemObject") Set Import = objFSO.OpenTextFile(strFilename) '---Loads Previous Values---' New_List = "" Do Until Import.AtEndOfStream LineData = Import.ReadLine For Each Item in Request.Form If Left(LineData,3) = Item then '--Same Question 'Response.Write "Found Question " & Item & "
" '--Find All Button Values Position("B") Position = 1 Start_Pos= 1 Do until Position = 0 Position = Instr(Start_Pos,Request(Item),"B") If Position <> 0 then '--Found B result Start_Pos = Position + 1 'Response.Write "Found A Result" Button_Result = MID(Request(Item),Position,3) 'Response.Write " " & Button_Result & " " & MID(Linedata,5,3) & "
" If MID(LineData,5,3) = Button_Result then 'Response.Write "Match found" '--Incriment value--' New_Value = MID(LineData,10,10) + 1 '---Add to New List---' Do Until Len(New_Value) = 10 New_Value = "0" & New_Value Loop '--Add New Values to New File---' If Item <> "B1" then New_List = New_List & Item & "_" & Button_Result & New_Value & vbcrlf End If End If End If Loop End If Next If New_Value = "" then New_List = New_List & LineData & vbcrlf End If New_Value = "" 'Response.Write RecordCount + 1 & " -- " & New_List & "
" RecordCount = RecordCount + 1 Loop Import.Close '---Save New Results---' Set F = objFSO.CreateTextFile(strFilename) f.Write(New_List) f.Close '---Save total submit number (a simple hitcounter)---' Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set a = objFSO.OpenTextFile(CounterFile, 1, 0, 0) c = a.Readline set objFSO = Nothing c = FormatNumber(c + 1,0) REM ....FormatNumber Returns an expression formatted as a number. Set objFSO = CreateObject("Scripting.FileSystemObject") set b = objFSO.CreateTextFile (CounterFile, 1, 0) REM Create the file again b.WriteLine c Set b = Nothing End Sub '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' Sub Show_Results() For Each Item in Request.Form Response.Write Item & "_" & Request(Item) & "
" Next End Sub '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' Sub Show_Survey_Results() Set objFSO = CreateObject("Scripting.FileSystemObject") Set Import = objFSO.OpenTextFile(strFilename) Do Until Import.AtEndOfStream 'Response.Write Import.ReadLine & "
" LineData = Import.ReadLine '---Determine Question And Answer---' If Trim(LineData) <> "" then Ques = Left(LineData,7) Result = FormatNumber(MID(LineData,10,10),0) '---Display Results---' Response.Write Ques & " = " & Result & "
" End If Loop End Sub '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' Sub Load_Survey_Results() Set objFSO = CreateObject("Scripting.FileSystemObject") Set Import = objFSO.OpenTextFile(strFilename) Do Until Import.AtEndOfStream 'Response.Write Import.ReadLine & "
" LineData = Import.ReadLine '---Determine Question And Answer---' If Trim(LineData) <> "" then ReDim Preserve AryData(2,RecordCount + 2) AryData(1,RecordCount + 1) = Left(LineData,7) AryData(2,RecordCount + 1) = FormatNumber(MID(LineData,10,10),0) '---Display Results---' 'Response.Write Ques & " = " & Result & "
" End If RecordCount = RecordCount + 1 Loop End Sub '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' Function Display_Value(Ques) For A = 1 to Ubound(AryData) '--If ques is this (Q01_A01)---' If AryData(1,A) = Ques then Display_Value = AryData(2,A) End If Next End Function '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' '------------------------------------------------------------------' Function Show_Total_Submit() Set objFSO = CreateObject("Scripting.FileSystemObject") Set a = objFSO.OpenTextFile(CounterFile, 1, 0, 0) c = a.Readline set objFSO = Nothing Set a = Nothing Show_Total_Submit = C End Function '------------------------------------------------------------------' '------------------------------------------------------------------' '---Now show results---' Call Save_Results() 'Call Show_Results() Call Show_Survey_Results() Call Load_Survey_Results() %>

this is a test
the result of Q#1 value #1 is:<%Response.Write Display_Value("Q01_B01") %>
Out of :  <%=Show_Total_Submit%> submissions

To show the results of a given question you put
Response.Write Display_Value("Q01_B02")

To show total submits:
Response.Write Show_Total_Submit