Getting ID via link

How to get ID from link (From dynamically generated content) and get that ID onto the next page?
The product is linking to the product page where I will display the content there, but how do I pass that ID over?

<?php 		
$result = mysqli_query($con, "SELECT * FROM products");	
		  
while($row = mysqli_fetch_array($result)) {
?>					

    <div class="col-lg-3 col-md-6 mb-4">
      <div class="product align-items-left">
        <div class="view overlay productview">
          <img src="img/<?php echo $row['productimage']; ?>" class="img-top"
            alt="">
          <a>
            <div class="mask rgba"></div>
          </a>
        </div>
        <div class="cardtext">
          <a href="productpage.php?id=<?php echo $row['productID'];?>">
            <h3><?php echo $row['name']; ?></h3>
          </a>
			<h4><?php echo $row['price']; ?></h4>
			<h5><?php echo $row['gen']; ?></h5>
        </div>
      </div>
    </div>
<?php 
}
?>

Many thanks.

if(!isset($_GET['id'])  {
    header('location: index.php');
    exit();
}
echo $_GET['id']
Sponsor our Newsletter | Privacy Policy | Terms of Service