No problem...with two global changes...and you are most welcome, I use answering questions as my learning experience. I am a new at this also.
<?php
if (!isset($questionnum))
$questionnum=1;
else
$questionnum++;
$_SESSION['answers']=array();
$POST['answer']="there is not gravity, the world sucks";
//echo "</br>".$POST['answer']."";
$SESSION['answers'][$questionnum]=$POST['answer'];
$questionnum++; // increment question number
$POST['answer']="I like red wine, but white is better for fighting off food posioning";
//echo "</br>".$POST['answer']."";
$SESSION['answers'][$questionnum]=$POST['answer'];
$questionnum=1;
foreach ($SESSION['answers'] as $thisanswer)
{
echo "</br>".$SESSION['answers'][$questionnum]."";
$questionnum++;
}
//
//or this where
// quetions and answers are contained in the array
unset ($questionnum);
if (!isset($questionnum))
$questionnum=1;
else
$questionnum++;
$_SESSION['questansw']=array();
$POST['question']="is there gravity?";
$POST['answer']="there is no the world sucks";
$SESSION['questansw']['question'][$questionnum]=$POST['question'];
$SESSION['questansw']['answer'][$questionnum]=$POST['answer'];
$questionnum++;
$POST['question']="Which color wine is better for fighting off food posioning?";
$POST['answer']="White! but I like red wine better";
$SESSION['questansw']['question'][$questionnum]=$POST['question'];
$SESSION['questansw']['answer'][$questionnum]=$POST['answer'];
for ($i=1; $i<=$questionnum; $i++)
{
echo "</br>Question was:".$SESSION['questansw']['question'][$i]." Answer was: ".$SESSION['questansw']['answer'][$i]."";
}
exit();
?>