Ben HTML biçiminde bu kodu vardır:
<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>
Ve sonra başvurulan cart.php dosyasında I vardır:
$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.
Örnek: 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.
Bir fark yaparsa ben PHP için bir Wordpress şablon dosyası kullanıyorum.
EDIT: I have quickly learned that I am not all that familiar with PHP at all, I barely know the ropes at this point.