I'm creating an banner management tool which uses an SQL database to store its data once added. there is a tab which shows for every banner in this database an update and delete button. These buttons are created in a PHP based loop so i will have X amount of update and delete buttons.
Now depending on which button i press i will go to an update vieuw of the the item wherunder the update button was clicked.
The problem i encounter since these buttons all have the same name is that i can't distinguish which button has been pushed. Every item in the DB has en ROWID, however i can't figure out how to get the ID once u push the button...
Here is the code of how these buttons are generated.
$entry = $dbase->querySingle("SELECT name FROM banners where ROWID='$currentRowNumber'");
echo "<td width=\"50\">". $entry ."</td>";
echo "<td><input type=\"submit\" name=\"operation\" value=\"Update\"></td>";
echo "<td><input type=\"submit\" name=\"operation\" value=\"Delete\"></td>";
} while ($dbase->querySingle("SELECT name FROM banners where ROWID='$currentRowNumber'") != NULL);
You could wrap all operations per row in a form that has an
input type="hidden" value="$id" containing the ID of the item, or use an
action="/update?id=$id" per form, or, if you want to stick to one large form, you could use
name="update[$id]" for the submit button.