How to display discount percentage if discount percentage is greater than zero? PHP -
i have php script selling deals. currently, there 2 requirements deal; 1 deal_value (original price) , special_value (discount price). have variables: deal_value, special_value, deal_percentage (which coded discount percentage). these inserted database already.
so how show discount percentage label if deal percentage > 0%?
fyi: have php html hot label already, how code , display hot_label if deal percentage > 0%?
also, need echo whole div= hot_label, there php inside , because there css in class=hot_label
<div class="hot_label"> <p>off</p> <b><?php echo round($h->deal_percentage); ?>%</b> </div>
<?php if ( $h->deal_percentage > 0) { echo '<div class="hot_label"><p>off</p><b>' . round($h->deal_percentage) . '%</b></div>'; } ?>
Comments
Post a Comment