I have am currently working on a web shop. The website has a small basket in the top right that shows the current price of all the products in the basket. It shows the correct number, however only updates the number after a refresh of the page, or after you navigate to another place on the website.
I have a file called basket.php which correctly calculates the sum of the products and puts it in a variable called $sum. There is also a file called tinybasket.php, which is only for showing the small basket in the top right.
Basket.php uses this code:
$_SESSION['sum'] = $sum;
tinybasket.php has this code:
echo $_SESSION['sum']
How do i update the tinybasket in the top right, without the user having to refresh or navigate to another page?