Hi, I'm trying to figure out how to get php to interact with checkboxes. What I'm trying to do is only update the fields where the checkbox is checked.
here's some code
My idea is to give the checkbox the same name as the ID. But the only problem I see with that is how do I get it to process the multiple checkboxes when it's submitted? Some kind of loop i guess...PHP Code:<?php
echo '<form>';
echo '<table border="1" width="100%" style="text-align:center;">';
echo '<tr><th>Game ID</th><th>BrokenLink #</th><th>Title</th><th>URL</th><th>Category ID</th><th>description</th><th>Fixed?</th></tr>';
$sql = "SELECT * FROM games WHERE brokenlink > 1 ORDER BY brokenlink";
$query = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_object($query)){
$id = $row->ID;
$title = $row->TITLE;
$url = $row->URL;
$catid = $row->CategoryID;
$desc = $row->description;
$brokenlink = $row->brokenlink;
echo '
<tr><td>'.$id.'</td><td>'.$brokenlink.'</td>
<td><input type="text" name="title" value="'.$title.'" maxlength="30" /></td><td><input type="text" name="url" value="'.$url.'" /></td>
<td><input type="text" name="catid" value="'.$catid.'" maxlength="1" style="width:15px;" /></td><td><textarea name="desc" value="'.$desc.'"></textarea></td>
<td><input type="checkbox" name="fix" /></td></tr>
';
}
echo '</table>';
echo '</form>';
?>





Bookmarks