I am writing a simple shop in PHP (as a practice). I want to add functionality, that when I click the submit button, ToastR is shown: "Product successfully added to cart".
I am new to PHP.
The problem is, that form get submited (and page refreshed) and toastR doesn't have a chance to be shown. Can you suggest any solution to this problem?
Sample code:
<form method="post" action="index.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>">
<div><strong><?php echo $product_array[$key]["name"]; ?></strong></div>
<div class="product-price"><?php echo "$".$product_array[$key]["price"]; ?></div>
<div>
<input type="text" name="quantity" value="1" size="2"/>
<input id="addToCartButton" type="submit" value="Add to cart" class="btnAddAction" onclick="toastr.info('Page Loaded!')"/>
</div>
</form>
I add all neccessary css and js (toastR is working in other places)