How do i disable a button if the prod_quantity == 0?
<?php
$prod_qty = $row['prod_quantity'];
if ($prod_qty == '0'){
echo "<h1>sold out</h1>";
}
?>
and here is the button that i need to be disabled when prod_qty == 0
<input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row["prod_id"]?>)" />
Add an
if
condition to the button to set the property asdisabled
if$prod_qty == '0'
like shown below :UPDATE 2 :
try this
javascript onclick function...
your button