I have a page which generates a table of descriptions stored in a mySQL table. Beside each description in the table I want to use an image that users can click on to be able to edit the data that is represented by that description.
If I use a checkbox for selecting which row to edit everything works great, but I want my page to be a little more "web 2.0" so I'm wanting to use a little magnifying glass image instead of the checkbox.
The applicable code in the table that generates the descriptions with the check boxes is:
while($row = mysql_fetch_array($result)) {
...
echo "<tr>
<td><a href=\"".$g_url.$searchterm."\" target=\"_blank\">".$description."</a></td>
<td align=\"center\"><input type=\"checkbox\" name=\"del_me[]\" value=\"".$description."\"/></td>
</tr>";
After selecting a checkbox the user is sent to a page which has text boxes with all of the fields which can then be edited. The php for that page is:
$del_me = $_POST['del_me'];
$valid_user = $_SESSION['valid_user'];
do_html_header();
check_valid_user();
if (count($del_me) > 0) {
foreach($del_me as $del_description) {
edit_user_search($valid_user, $del_description);
}
}
The above works great, but checkboxes, aside from not being visually appealing, allow the user to select more than one record to view and that is outside the scope of what I want to present to them.
I tried changing the line with the checkbox to:
<td>
<input type=\"hidden\" name=\"del_me\" value=\"".$description."\">
<a href=\"#\" onClick=\"bm_table.submit();\"><img src=\"magnifier.gif\"></a>
</td>
and removed the foreach loop on the second page (just leaving the function call), but this results in the data for the last line in the description table being output to the second page no matter which row I actually choose.
How can I get the $description table field correctly sent to the second page?
TIA