I have this code in my HTML form:
<form action="cart.php" method="post">
<input type="hidden" value="1" name="sample_" id="sample_">
Sample Bottle <br /><input type="submit" value="Add to Cart" name="sample"><br />
</form>
<h1>Cart Total: $<?php echo $cart; ?></h1>
And then in the referenced cart.php file I have:
$cart = 0;
$samples = ($_POST['sample_']) * 50;
$cart = $cart + $samples;
echo $cart;'
Unfortunately, this code isn't doing what I want it to and I need some help. Ideally, I simply want the code to add "50" to the Cart, which starts at 0, when the Add to Cart button is pressed.
Example: http://www.craighooghiem.com/linpap/order
Can someone tell me how I can do this in a much simpler way?
Apparently I can use <?=$_SERVER['PHP_SELF'];?>
somehow to perform this function without leaving the file, but everytime I attempt to do that it takes be back to the website's homepage.
I am using a Wordpress template file for the PHP if that makes a difference.
EDIT: I have quickly learned that I am not all that familiar with PHP at all, I barely know the ropes at this point.