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

<table width="536" height="54">
                                <td class="deco">Q<?php echo $index.") ".$questions; ?> </td>
                                 <td width="15"></td>
                             <?php while($row_wrong_ans = mysql_fetch_array($res_wrong_ans)){ 
                                    $op_index = $row_wrong_ans['fbo_index']; 
                                    $op = $row_wrong_ans['fbo_ans'];
                                <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 />
                        <?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

Recommended Answers

All 3 Replies

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 />"; 

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.