<?php

$qty = $_post['qty'];
$rate = $_post['rate'];

$total = $rate * $qty;

echo $total;

?>

i want to print the float number in total but it gives rounded Number

I just ran this code. The answer was not rounded. (.751)

<?php

$qty = 0.1;
$rate = 7.51;

$total = $rate * $qty;

echo $total;

?>

Use sprintf() to control your output

I just ran this code. The answer was not rounded. (.751)

<?php

$qty = 0.1;
$rate = 7.51;

$total = $rate * $qty;

echo $total;

?>

yes this is working but i want to get values from text box

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.