I have a php input form that I enter a ‘Net Price’ into mysql.
I have a seperate page that pulls that data into a table in a ‘Quotations’ page via ‘echo’.
I am trying to ‘automatically’ calculate VAT and Total amounts from the ‘Net Price’, which I can do via “$row[“Net_Price”]*0.2″ & “$row[“Net_Price”]*1.2″ but I cannot get it to display to only 2 decimal places (always shows 3).
Have tried adding javascript to the “” through research on here like the below:
echo"<td onchange='(function(el){el.value=parseFloat(el.value).toFixed(2);})(this)'>£ " . $row["Net_Price"]*0.2. "</td>";
Unsure if this is an impossible method, or if I should be attacking this differently, so help is appreciated.