English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Here's the code:
----------------------------------------------------------
$XXX = 500; //value can be input numerous ways
$A = $XXX - (($XXX * 0.034)+0.3);
$B = $A - ($A * 0.1);
$C = $B* 1.1;
$D = $C - (($C* 0.025) + 5);
$E = $D * 7827;
echo number_format($E);
// show your answer in this formate show 688,413

?>
----------------------------------------------------------
* originally helped by,
catbertnc and Mohd.SAQIB Q.. Thanks Guys!!

Now further question:
What's the input syntax, so i will have a box,
like a search box, where i can key in various input numbers.
And when i click "calculate" it will echoes E.

What i mean is to have a web page, with an input box and calculate button.
And when pressed will automatically shows the result.

Thank you verryyy much.. :D

2007-12-14 19:27:51 · 3 answers · asked by Le Buane 2 in Computers & Internet Programming & Design

3 answers

Ok, the easiest way requires two scripts. I'll call the first one form.php and the second calculate.php. The first holds the form the user will use, and the second will perform the calculations.

form.php
---------------
echo "

";
echo "Number:
";
echo "";
?>
-------
calculate.php
--------------
$XXX = $_POST['xxx'];
$A = $XXX - (($XXX * 0.034)+0.3);
$B = $A - ($A * 0.1);
$C = $B* 1.1;
$D = $C - (($C* 0.025) + 5);
$E = $D * 7827;
echo number_format($E);
// show your answer in this formate show 688,413

?>

That should do it.

2007-12-14 20:44:41 · answer #1 · answered by catbertnc 5 · 0 0

PHP have no way to input from the user, for that matter any server side script would have to use HTML to display or fetch user data, either by AJAX or form.

2007-12-14 19:44:47 · answer #2 · answered by Andy T 7 · 0 0

i dunno, lol

2007-12-14 20:09:00 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers