Hi,
I am setting up a form for interviews that will be stored in a DB and will allow 40 boxes for 20 q's and 20 responses. So the person setting up the interview will paste Question1 into the Q1 box,..then paste Response1 into the R1 box,..Question2 into Q2 box,..and so on.
The number of interview questions will range between 12 or so and 20. So if I do a "SELECT q1, r1, q2, r2,.......q19, r19, q20, r20 FROM interview_table"
and get this:
$q1 = "blah";
$r1 = "blah";
$q2 = "blah";
$r2 = "blah";.....
and want to get the variables in a loop by using $i, how would I go about it? I basicaly want to just echo them in a row but NOT echo for any fields that are blank to allow for less than 20 questions being input. I tried this:
$i=1;
while($i<=20){
$num="q$i";
echo "$num<br>";
$i++;
}
but it echoes as
q1
q2...
I'd seen somewhere a technique that looked like this:
$num=$q['$i'];
or this:
$num="q['$i']";
but neither are working.
It will eventualy be echoing like this:
"<span class=\"style22\">$interviewer_name: </span><span class=\"style28\">$q1</span><br><br>
<span class=\"style27\">$interviewee_abbr: </span>$r1<br><br>";
So to summarize, how would I make the number increment and also, how would I get it to stop echoing when it reaches the final question if there are less than 20?
Thank you very much.