VB Script
I'm having trouble with a loop I created. I have a form that loops through 11 questions with 4 possible answers for each question. The user selects his/her answer by clicking on one of a group of 4 radio buttons. However, with my current loop the grouping for the radio buttons stays the same for all of the questions. How can I create a variable for the grouping that will change as the loop increments. Here is the code it may help.
<?php
Do While Not rsQuestions.EOF
?>
<?php
=(rsQuestions.Fields.Item("Question ID").Value)
?>
<?php
=(rsQuestions.Fields.Item("Question").Value)
?>
A.
<?php
=(rsAnswers.Fields.Item("a").Value)
?>
B.
<?php
=(rsAnswers.Fields.Item("b").Value)
?>
C.
<?php
=(rsAnswers.Fields.Item("c").Value)
?>
D.
<?php
=(rsAnswers.Fields.Item("d").Value)
?>
<?php
rsAnswers.MoveNext
?>
<?php
rsQuestions.MoveNext
?>
<?php
Loop
?>
KLWong posted this at 18:45 — 29th November 2000.
They have: 135 posts
Joined: Apr 2000
What you need to change is the "name" field in the input tag. It should be a variable within your loop. You might consider something like this:
Then the names of your radio buttons will be the same as your Question IDs. You will need to do the same sort of looping, of course, on the page which processes the form.
Take a look at my cancerdrugfeedback site, which makes extensive use of these types of radio buttons to report on drug side effects; I can email my source code to you if you are interested.
Kristen
http://www.RewardsLookup.com and
http://www.cancerdrugfeedback.net still under early development
Personal page:http://www.isd.net/kwong/kristen.html
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.