<%@ Language=VBScript %> Jain World

<% Dim space select case Request.QueryString("step") case 1 sid = Request.QueryString("sid") '---------------- step 1 - List all surveys except inactive ones ----------- %> <% sql="SELECT id, name FROM dissurvey where active=1" set rs=con.execute(sql) if not rs.EOF Then while not rs.EOF %> <% rs.movenext wend else%>


No records into the database
<% end if %>


l  "><%=rs("name")%>





<% case 2 '---------------- step 2 .List the chosen survey -------------------------- sid=Request.QueryString("sid") sql="SELECT id,name,description,viewresults,mediafile,rows,doonce FROM dissurvey where id="&sid set rs1=con.execute(sql) sid=rs1("id") sname=rs1("name") sdescription=rs1("description") sresults = rs1("viewresults") media = rs1("mediafile") rows = rs1("rows") doitonce = rs1("doonce")%>
<%=sname%>

<%=sdescription%>
<% if media <> "" then media=replace(media, " ", "%20") %> <%end if %> <% if sresults= 1 then %>
You may also view our tabulated results without completing the survey.

<% end if %> <% ' done = "completed"&sid if doitonce = 0 then Response.Redirect("start.asp?step=5") end if %>
<% sql="SELECT * FROM dssquestions where sid="&sid&" order by qnumber" set rs3=con.execute(sql) if not rs3.EOF then while not rs3.EOF %> <% if rows=0 Then space="
" else space="   " End If %>
<%=rs3("qnumber")%>)  <%=rs3("description")%>
<% if rs3("option1") <> "" then %> " value="1" checked>  <%=rs3("option1")%><%=space%> <% end if %> <% if rs3("option2") <> "" then %> " value="2">  <%=rs3("option2")%><%=space%> <% end if %> <% if rs3("option3") <> "" then %> " value="3">  <%=rs3("option3")%><%=space%> <% end if %> <% if rs3("option4") <> "" then %> " value="4">  <%=rs3("option4")%><%=space%> <% end if %> <% if rs3("option5") <> "" then %> " value="5">  <%=rs3("option5")%><%=space%> <% end if %> <% if rs3("allowin")= 1 then %>

 <%=rs3("writein")%>

  <% End If %>

<% rs3.movenext wend End If %>
<% case 3 '---------------------- step 3. Save and display----------------------------- sid = Request.Form("sid") sql="SELECT name,viewresults FROM dissurvey where id="&sid set rs = con.execute(sql) sname = rs("name") sresults = rs("viewresults") dat= date rr = 0 nnn = 1 sql1="SELECT id, allowin FROM dssquestions where sid="&sid set rs1=con.execute(sql1) if not rs1.EOF then while not rs1.EOF id = rs1("id") rr ="q"&id rr = Request.Form(rr) if rr = "" then rr = 0 end if 'if rs1("allowin")= 1 then wi ="w"&id wi = Request.Form(wi) ' This code is only for online and staging --> 'set resid = con.execute("select max(id) as cnt from dssresults") 'rid = resid("cnt") 'resid.close 'set resid = nothing if wi <> "" then sql2="INSERT INTO dssresults (qid,sid,chosen,dates,userip,writein) values ( "&id&", "&sid&", "&rr&", '"&dat&"','"&i_ip&"','"&wi&"')" else sql2="INSERT INTO dssresults (qid,sid,chosen,dates,userip) Values ("&id&","&sid&","&rr&",'"&dat&"','"&i_ip&"')" End If 'Response.Write sql2 &"
" con.execute(sql2) select case nnn case 1 sql3="SELECT max(id) FROM dssresults" set rs3 = con.execute(sql3) cc = rs3(0) End Select sql4 = "SELECT max(id) FROM dssresults" set rs4=con.execute(sql4) maxx = rs4(0) sql5="UPDATE dssresults SET cookie="&cc&" WHERE id="&maxx con.execute(sql5) nnn = nnn + 1 'End If rs1.movenext wend end if 'Response.Cookies("ccc") = cc 'Response.Cookies("ccc").expires = "Jan 1 , 2010" ' ' %>

Back to choose a survey

<%' if sresults = 1 then%>See the tabulated results to the <%=sname%> survey.<%' end if %> %>


<% case 5 %>

You can only do this survey once.

Back to choose a survey<% End Select set rs= nothing set rs1=nothing set rs2= nothing set rs4 = nothing %>