Jump to content

Post Radio as an array


xxreenaxx1

Recommended Posts

I have worked on a while loop as a radio and this dispalys well and Now I am trying to post this to the next page. But kind of stuck. This is my while loop for the form

$intNum = 1;
$intnumber = 1;


while( $info = mysql_fetch_array( $sqll )){  
  echo "<input type='hidden' name=\"Que_ID\" value=\"{$info['Que_ID']}\" /> ";
  echo " $intNum, {$info['Que_Question']} <br />\n"; 
   $intNum++;

for ($i =1; $i < 5; $i++) {  

echo "<input type=\"Radio\" name=\"choice[{$intnumber}]\" />{$info['Que_Choice'.$i]}<br />\n";  
  $intnumber++;
}
}


?>
<input type="submit" name="submit" value="submit"/>

</form>
</body>

</html>

 

Now in order for me to post this to the next page, can I do something like

if (isset($_POST['Submit1'])) {
$qu=$_POST[Que_ID];
$choi=$_POST[choice];
for($i=1; $1=5; i++)
echo $qu. $choi;

 

this is just my guess. I want the que_ID to display four choice for each question ID. so it would be Question ID=2(choice1=selected, choice2=notselected, choice3=not selected, chocie4=not selected) and this would be repeated to the next question ID.

 

So far I can notice that my chociename are added by one(choice1, choice2,choice3,choice4,choice5,choice6,choice7,choice8,choice8......) so my post for loop will not work work as my choices goes up to more then 5.

Link to comment
https://forums.phpfreaks.com/topic/229862-post-radio-as-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.