I have variables $q1 - $q50. I want to loop through and see if they are set before I go on to the next bit of code. I am trying to use a for loop and eval. I think I am using eval incorrectly, probably because I am so used to actionscript. Can anyone take a loot at this for me and tell me what I’m doing wrong?
for($i=1;$i<51;$i++){
if(isset(eval("$q".$i))){
$valid = TRUE;
}else{
$valid = FALSE;
echo "Please make sure all questions are answered.";
break;
}
}