I have an HTML table that has rows generated with PHP and populated with MySQL data. I want the rows to be clickable, where onclick they open a new window with the MySQL data for that row.
What method can I use to POST a value on click and open the PHP page in a new window without disturbing the parent page? My rows are generated similar to this:
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "
<tr onclick=\"openDetails(" . $row['id'] . ")\"> //openDetails() does nothing for now…
<td>" . $row['id'] . "</td>
<td>" . $row['ser'] . "</td>
<td>" . $row['part'] . "</td>
<td>" . $row['model'] . "</td>
<td>" . $row['make'] . "</td>
<td>" . $row['description'] . "</td>
<td>" . $row['price'] . "</td>
</tr>";
openDetails();
does nothing but I thought JS (I'm open to JQuery solutions) was the key. The overall idea is that someone clicks the row and they get assets_details.php (Which will query for WHERE id=$_POST['id']
and populate a form) in a new window where they can edit and submit the information. If POST isn't possible a $_SESSION
variable would do, I just don't know how to set either "onclick".