How do i generate links that will display these products depending on the ID from the database to another page (product page) in php - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, August 31, 2022

How do i generate links that will display these products depending on the ID from the database to another page (product page) in php

<?php                      
    foreach($products as $i => $product): ?>
    <article class="products__card">
        <a href="./product.php?id">
            <img src="<?php echo $product['image'] ?>" alt="" 
        class="product__image">

            <h3 class="products__title"><?php echo 
            $product['Device_name'] ?></h3>
            <span class="products__price"><?php echo 
        number_format($product['price']) ?> UGX</span>
        </a>
        <button class="products__button">
        <i class="uil uil-shopping-bag"></i>
        </button>
        <input type="hidden" name="id" value="<?php echo $product['id'] 
                    ? 
                >">
    </article>
<?php endforeach; ?>

The sql is okay the column for id exists but I am not sure how to generate pages depending on the id of the clicked item.



source https://stackoverflow.com/questions/73534733/how-do-i-generate-links-that-will-display-these-products-depending-on-the-id-fro

No comments:

Post a Comment