In response to your questions:
$num_possible_answers is being posted to this page from a previous one and comes through as the correct value, eg, 4.
I have this as the form wrapper:
<form name=\"form1\" method=\"post\" action=\"multichoice2.php\">
...code...
<input type=\"submit\" name=\"Submit\" value=\"Next\"></form>
then multichoice2.php receives the values from the form.
I then try to insert it in a db (which works fine). Its just that the values are wrong. They come as the value of $i, not the text that was entered in the form. I can show this by doing:
echo "$answer$i" ;
HOWEVER, I have just had a small breakthrough using the following code:
echo "Firstly, the answer is $answer1";
// this gives the correct answer, ie, the text from the form box
for ($k = 1; $k<=$num_possible_answers; $k++) {
echo "The answer is $answer$k....";
//this gives the wrong answer, ie, 1, (or value of $k)
Looks like it is some sort of pointer issue. I'm not sure how this should work in PHP. So I could solve the problem by handwriting all the variable names but I would like to put it in one simple loop as above. Any ideas? (thanks)