I want to make a site for a book store website which is building with raw PHP. I have shown my books from MySQL database. Now if any customer wants to add any book to the cart then it will save to a session array and it will show on cart.php on another page with name quantity price and grand total. Now I am unable to show this data to cart.php (In another page). I can show on the same page. Thanks a lot.
Here are my books showing code from MySQL database.
Thanks.
<?php include_once 'template/head.php';?> <?php include_once 'template/nav.php';?><div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1 class=>Bookish Collection</h1>
</div>
<?php
include_once 'databaseConnect.php';
$conn=connect();
$sql = "SELECT * FROM books";
$output = $conn->query($sql);
foreach($output AS $row){
?>
<div class="col-lg-4 col-md-6 mb-4">
<div class="card" style="width:300px">
<img class="card-img-top" src="img/<?=$row['image']?>" alt="Card image" style="width:100%">
<div class="card-body">
<h4 class="card-title">Books Title:<?=$row['bookName']?></h4>
<p class="card-text">by <?=$row['authorName']?></p>
<p class="card-text">Price:<?=$row['price']?></p>
<p class="card-text"><?=$row['blurb']?></p>
<a href="#" class="btn"><i class="fa fa-shopping-cart"></i>Add To Cart</a>
</div>
</div>
</div>
<?php } ?>
</div>
</div>