How to add to cart without reload page using php code

we are add to cart in e-commerce website without reload page use the php simple code. and get id the cart in session that are the send value through cart button with session. //Get session value $_SESSION[‘cart’]; if(isset($_GET[‘action’]) && $_GET[‘action’]==”add”){ $id=intval($_GET[‘id’]); if(isset($_SESSION[‘cart’][$id])){ $_SESSION[‘cart’][$id][‘quantity’]++; } else{ //Get product id $sql_p=”SELECT * FROM products WHERE id={$id}”; $query_p=mysqli_query($con,$sql_p); … Read more