Hello I would like to send an email with php code.
I have the following script calculation that works:
<script type="text/javascript">
window.onload = function () {
var total_of_order= <?php echo $order_total ?>;
var extra_costs= 38;
var total = Math.ceil(parseInt(total_of_order) - extra_costs);
$('calculateTotal').innerHTML = total;
}
</script>
<div id="calculateTotal"></div>
How can I code this to pure php?
Like?
<?php echo $extra_costs; $extra_costs= "38";?>
<?php echo $order_total ?>
<?php echo $total = Math.ceil(parseInt(order_total) - extra_costs);?>
As you can see I”m the worst coder, could someone help me?
dfasf
Use the
ceilfunction, withoutMath.prefix. Also, since you’re doing your calculations in PHP, you can directly output the result in the<div>, without any JavaScript.