SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Cambs
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Multi page questionnaire Help!!!!!

    Right I need to create in asp/access/javascript a questionnaire that shows a single question on each page of which there are five then after the last question create a new record in the access db and write the answers.

    How would I do this?

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you're going to have 5 form pages (or 1 dynamic form page), when you click Submit on each page it temporarily stores the data and redirects you to the next question. As for storing the data temporarily you can:
    - Store it in session variables
    - Write it to a database
    - Pass it to the next form page that stores it as a hidden form field, with the final page doing the database writing.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    london
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did this a little while ago. You can put all questions on one page then use IF statements to determine what displays. Then, in each question portion, you just place something like "stage=1", thus, if request(stage)=1 then your code would display the next few questions.

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Cambs
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have an example?

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    london
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    	<%
    		iStage = Request.Form("Stage")
    		If iStage = 0 Then
    	%>
    			<form action="MultiForm.asp?<%=Request.QueryString%>" id="form1" name="form1" method="post">
    				First Name: <input type="text" id="First" name="First">
    				<input type="hidden" value="1" id="Stage" name="Stage">
    				<input type="submit" value="Submit" id="submit1" name="submit1">		
    			</form>
    	<%
    		elseif iStage = 1 Then
    	%>
    			<form action="MultiForm.asp?<%=Request.QueryString%>" id="form1" name="form1" method="post">
    				Last Name: <input type="text" id="Last" name="Last">
    				<input type="hidden" value="2" id="Stage" name="Stage">
    				<input type="hidden" value="<%=Request.Form("First")%>" id="First" name="First">
    				<input type="submit" value="Submit" id="submit1" name="submit1">		
    			</form>
    	<%
    		elseif iStage = 2 Then
    			Response.Write "Hello <B>" & Request.Form("First") & " " & Request.Form("Last") & "</B>"  
    		end If 
    	%>


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
  •