by clicking on "empty cart?", unsetting cart array working fine. wanted form hidden if "empty cart" button clicked.
html:
<form id="f1" action="checkout.php" method="post"> <input name="cust_login" type="submit" value="continue" /> </form> <br> <button><a href = "cart.php?cmd=emptycart">empty cart?</a></button> javascript:
<script> $(document).ready(function(){ $("button").click(function(){ $("#f1").hide(); }); }); </script> php code unsetting array:
if (isset($_get['cmd']) && $_get['cmd'] == "emptycart") { unset($_session["cart_array"]); but hide not working here.
my question is, can use button , link have written ? if not, how implement it?
try use this:
$(document).ready(function(){ var cmd = '<?php echo $_get["cmd"] ;?>' ; if(cmd == "emptycart") { $("#f1").hide(); } });
Comments
Post a Comment