Joe Herl wrote:
> (1) Am I on the right track, or is there conceptually a
better way to make
> this work?
There are three ways that you could do it. One is to put each
question
on a separate page, and get the students to answer the
questions in a
given order. After inserting the answer to question one, you
send them
to the page for question two, and so on.
Another way is to put everything in one form and use arrays
to gather
the answers. To create an array, you use square brackets
after the name
attribute like this:
name="question[]"
When the form is submitted, you would then need to hand-code
loops to
insert each question and answer individually. It's quite easy
to do, but
you can't automate it with Dreamweaver.
The third way to do it is less than ideal, but might be worth
considering if you know that you will *always* want only
three
questions. Create columns for q1_id, q2_id, q3_id, question1,
question2,
and question3. You can then insert everything in a single
operation.
> (2) How do I get the studentID from the top of the page
into the database?
It needs to be part of the form. As you have discovered, only
one form
can be submitted at a time.
> (3) How do I get the questionID (which identifies the
question the student is
> answering) into the database?
Again, it's got to be part of the form. I presume that you
will pull the
questions from the database. Retrieve the question ID at the
same time,
and store it as a hidden field (see page 280 of my book).
--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/