Jump to content

Post Radio as an array


xxreenaxx1
 Share

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
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.