I would like to read table data and output it to a page as radio button then when the visitor changes the values it will pass the new values to the database.
<?
// Pull the data from the database
$query_select = "SELECT * FROM searches where visible = 1 order by url LIMIT 20";
$new_result = mysql_query($query_select);
// Determine how many rows were returned.
$num_rows = mysql_num_rows($new_result);
// Assign the database data to a variable.
$aResult = mysql_fetch_array($new_result);
// Counter
$color = 0;
$checksum = $aResult['checksum'];
do{
if ($color == 1) {
echo '<tr id=iframealt2 >';
$color = 0;
}
else {
echo '<tr id=iframealt >';
$color = 1;
}
// creates the checkbox for the remove option.
echo '<td><input type = checkbox name = visible></td></td>';
if ($checksum == 1){
// Passes the id data to the radio button as a unique id
print '<td><input type="radio" name="Q'.$aResult['id'].'" checked"></td><td><input type=radio name="Q'.$aResult['id'].'" value="'.$aResult['checksum'].'"></td>';
}
else
if (checksum == 0){
print '<td><input type=radio name="Q'.$aResult['id'].'" value="'.$aResult['checksum'].'"></td><td><input type=radio name="Q'.$aResult['id'].'" checked"></td>';
}
echo '<td>' . $aResult['short_name'] . '</td><td>' . $aResult['url'] . '</td><td>' . $aResult['id'] . '</td>';
echo '<td><input type=submit class=button name =button value=UPDATE></td></tr>';
} while ($aResult = mysql_fetch_assoc($new_result));
?>
The radio buttons name are defined by the database record id prefixed by the letter Q. ex( Q357401). This gives the radio button a unique name.
Each row gets a remove option which removes it from the list but never from the database that feature is reserved for the master account administrator .
Each row is also given an update feature to individually update a single row or they can use the update all feature to update and the changes made in the list.
The problem is getting all of the radio button names whose values have changed and pass them to the database.
If you need more data or table structure or anything let me know.