Basically I have one page titled allListings.php (displays all listings for an item) and another page titled viewListing.php (where you can view the details of one listing). In this allListings php page I created a table using a database I made from SQL. In one of the table columns, I have a button titled "View Listing", where if you click on it it should send you to the view listing page (which works). In the all listings page, each row is assigned a listing ID but I don't know how to get it so that when you click on each individual view listing page it sends you to the adequate page, not just the first listing from the database. I dropped some of my code below for reference.
$sql = "SELECT * FROM listing";
$result = $mydb->query($sql);
while ($row = mysqli_fetch_array($result)) {
echo "<tr>
<td class='orange'>" . $row["Listing_ID"] . "</td>
<td class='light'>" . $row["Book_Title"] . "</td>
<td class='light'>" . $row["Price"] . "</td>
<td class='light'>" . $row["Description"] . "</td>
<td><button type='submit'>View Listing</button></td>
</tr>";
}
The view listing page currently has a HTML form set up. I want it so that each view listing button gets sent to the appropriate view listing page and not just the same first database entry page, so I guess one way to go about it is to assign each table row a variable? I'm not totally sure. (I have the classes in so I'm able to color code things with CSS)