I have a table where user MAC addresses and other info are displayed. I am adding an edit button to each of the entries through the for loop. My problem is how can I select one of those entries to display in another subroutine? In other words, when I click the edit button for one entry how can I bring that entry info up in another subroutine where I perform the edit function?
Below is my entry listing sub.
print <<EOF;
<br>
<table>
<tr>
<th>MAC</th>
<th>Description</th>
<th>UserID</th>
<th>Edit</th>
<th>Delete</th>
</tr>
EOF
foreach $test ( @list ) {
print "<tr>";
print "<td>" . scalar($test->mac()) . "</td>";
print "<td>" . scalar($test->comment()) . "</td>\n";
print "<td>" . scalar($test->username()) . "</td>\n";
print "<td>" . $editButton . "</td>\n";
print "</tr>";
}
Selecting something for editing is a non-destructive operation, so you would use a link.
You need to identify the thing to edit with something unique.
Assuming the MAC address is unique (it should be for devices, but might not be for users or comments) you could use that.
You can then access the value in the script that generates the editing form.