tags:

views:

27

answers:

1

The following code uses the DB extention provided by PEAR. I want a radio button against each record so that the user can select only one record from the list and submit. There can be hundreds of records from table.

// Proceed with getting some data...
$res =& $db->query('SELECT * FROM someTable limit 10');

while ($res->fetchInto($row)) {
echo "<tr><td>";
    echo $row[0] . "\n</td><td>";
    echo $row[1] . "\n </td><td>";
    echo $row[2] . "\n</td><td>";
echo $row[5] . "\n</td><td>";
echo $row[6] . "\n</td>";
echo "</tr>";
}
+1  A: 

ok so put an <input type="radio" name="same-name-for-each" value="$this_record" /> between each table cell.

each radio button gets the same name

the value of each radio button needs to be different - the id or value of whichever option the selected radio represents.

Evernoob
perfect :) thanks
shantanuo
welcome! :) ...
Evernoob