Hi
I have a survey to set up, with 39 questions. The survey will be repeated at regular intervals but the questions will change. The style of answers will stay constant, some are radio buttons, some are tick boxes.
To save rebuilding the project each time the questions change, I have labelled the fields in the tables for the answers, q01, q02, q03, q04 .........
The text of the question, e.g. "Do you find the teaching style suits your way of learning?" is held in a field called `q` in another table called `v_q1`, indexed on an auto increment field of `q_id`.
I would like to be able to use the text from the field `q` as the question on the Add page for each record.
I have read the post about using Session Variables as field labels and I understand that I could load the questions into an array as a session varible, or at least I think i can??
is there a way i can reference the record from the `v_q1` table and use "echo" to put it onto the page instead of having the field title on the Add or Edit form?
So in the field label space in visual editor, I will have
echo `v_q1`.`q`
but it references the field index 1 for question 1 and field index 2 for question 2 etc?
Do i need something along the lines of
echo `v_q1`.`q` where `v_q1`.`q_id`=`q01`
??
Later on
While the board was down, I have played around and used this
global $conn;
$str1 = "select * from `v_q1` where `q_id`='1'";
$rs1 = db_query($str1,$conn);
$data1 = db_fetch_array($rs1);
$question=$data1["q"];
echo $question;
and it has worked for one field, I have 39 fields to do, this means that for each page of questions I will have 6 lookups going on at a time, is there a way to load all 6 records at once to speed up loading times and reduce the hard disc thrashing on the server?
Is there a way I can get the numbers from the label, and link the number to the record number in the questions table and just have some neater code?