I have a form and i can add datas to the table and store it in the session. what my problem is when ever i click remove button the id is in the url. so i cant add other datas.
I need to get rid of the get value after i click remove
its like this http://localhost:8085/examples/buyme.php?del=2 i need it to be like this http://localhost:8085/examples/buyme.php
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Product Name</th>
<th>Price</th>
<th>Quantity</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
<?php
if(!empty($_SESSION["cart"])){
$values;
$total=0;
foreach($_SESSION["cart"] as $keys=>$values){
$amount = $values["quantity"]*$values["price"];
$total=$total+$amount;
?>
<tr>
<td> <?php echo $values["id"] ?> </td>
<td> <?php echo $values["pname"] ?> </td>
<td> <?php echo $values["price"] ?></td>
<td><?php echo $values["quantity"] ?> </td>
<td><a href="buyme.php?del=<?php echo $values["id"] ?>"> Remove</a>
<a href="#editProductModal" class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit"></i></a>
</td>
<td> </td>
</tr>
<?php }?>
<tr>
<td></td>
<td></td>
<td></td>
<td>Total </td>
<td><?php echo $total ?> </td>
<td> </td>
<?php } ?>
</tr>
<!-- Removing from cart -->
<?php
if(isset($_GET["del"])){
foreach($_SESSION["cart"] as $keys=>$values){
if($values["id"]==$_GET["del"])
{
unset($_SESSION["cart"][$keys]);
echo "<meta http-equiv='refresh' content='0'>";//to refresh page after submit
}
}
}
?>
<br>
<br>
</tbody>
</table>
Please help me thanks in advance