0

I need to fetch questions with 4 optional answers from dtabase....
tables are questions | options...html code is below...

<table width="536" height="54">
                             <tr>
                                <td class="deco">Q<?php echo $index.") ".$questions; ?> </td>
                                 <td width="15"></td>
                             </tr>
                             <?php while($row_wrong_ans = mysql_fetch_array($res_wrong_ans)){ 
                                    $op_index = $row_wrong_ans['fbo_index']; 
                                    $op = $row_wrong_ans['fbo_ans'];
                             ?>
                             <tr>
                                <td width="473"><input type="radio" name="radio[<?php $index;?>]" value="<?php echo $op_index;?>"  /><?php echo $op; }?></td>
                                 <td><input type="hidden" name="hid" value="<?php echo $index;?> " /></td><br />
                              </tr>                            
                          </table>
                        <?php } ?>

In the next page I need to get the value of the Radio(having a dynamic name)...with $_POST..how to get it????
Plz help....
Thank you

2
Contributors
3
Replies
7
Views
5 Years
Discussion Span
Last Post by phpHelp
0

I would suggest you iterate through the $_POST['radio'] array. E.g.:

// Attempt to retrieve answers
$answers = isset($_POST['radio']) ? $_POST['radio'] : array();

// Iterate through each answer
foreach($answers as $question_id => $answer) {
    echo "Q{$question_id}: {$answer}<br />"; 
}
0

Thanks a lot...You are mind blowing....thank u so much..:):):)

0

Need to change a bit in HTML part..m trying myself if not then ll get back to u....thank u so much

Edited by phpHelp: I am trying myself...if not then ll get back to again...thank u

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.