I'm making a simple cart program in php. What the code below does is to update the current page, so that the quantity for the product that is bought will be zeroed. And then I tried to link it with another page, which performs another action(to update the database). What can I do with this experimental code that I made up:
echo "<td>
<a href=\"$_SERVER[PHP_SELF]?action=zeroline&id=$product_id&commitbuy.php?ids=$id&qoh=$qtyhand&qtb=$quantity\">
<img src=\"http://localhost/onlinestore/img/system/accept-icon.png\"></img></a>
</td>";
The part which updates the current page seems to be working but, the part that updates the database is not working. As you can see I just link those 2(PHP_SELF, which is viewcart.php and then commitbuy.php) together with an ampersand.
Should I just place the code that updates in the viewcart.php? Whats the proper way of doing this.