gcaine
Posts: 7
Joined: 04 Apr 08
Trust:
05 Apr 08 2:47 pm
It would be pretty simple with PHP, just collect the data from the form, do the calculation and display it.
Here's a simple example using calculate.php as the page that displays the result.
Here's the form
<p>
<form method="post" action="calculate.php">
<p>Weight <input type="text" id="weight" name="weight" /></p>
<p>Height <input type="text" id="height" name="height" /></p>
<p><input type="submit" id="submit" name="submit" value="Submit"></p>
</form>
</p>
Put this in calculate.php
<?php
foreach ($_REQUEST as $key=>$value){
${$key}=$value;
}
$total=$weight*$height;
echo "Your total is $total";
?>
It's a simple example, but you get the idea