bikes - 2011-02-24 08:46:41
Please how do i get my result displayed when i cilck on the calcluate price button. Hould i separate the codes to make sure my values are displayed accurately. The whole code is here:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dynamic Page</title>
</head>
<body>
<FORM METHOD = "POST" ACTION = "cal_price_form.php">
<FONT FACE ="Verdana" COLOR = "#1200FF">
<CENTER><B><H2> A program that calculates the cost of a product</H2></B></CENTER>
</font>
<br>
<br>
<?php
//Print todays date on the screen
$finddate= date("j-m-y");
echo "<h2>$finddate</h2>";
?>
Please type in the type of product
<INPUT TYPE = "TEXT NAME" =" product_type" maxlength=10 SIZE =10 ><br>
Please type in the name of the product
<INPUT TYPE = "TEXT NAME" =" product_name" maxlength=35 SIZE =35 ><br>
Please type in the cost of the product
<INPUT TYPE = "TEXT NAME" ="original_price" MAXLENGHT = 5 SIZE = 5>
<p>
<INPUT TYPE ="Submit" VALUE="Calculate price">
<?php
function calculate($original_price){
return $finalprice=($original_price * 0.16)+ $original_price;
}
echo"<br><h2><center>The type of product is:$product_type</center></h2>";
echo"<br><h2><center>The name of the product is:$product_name</center></h2>";
echo "<br><h2><center>The final price of the product is:".calculate($original_price)."</center></h2>";
?>
</body>
</html>