I have just developed my first program for calculation using the form on a page circular_area.htm The form is calculating the values through circle.php another page is pop-up and the values are dispalyed there. But I want my results to be displayed on the same html page. Please help me, what to do in this case. Many thanks in advance.
MY codes are as follows
-- circular_area.htm--
Code: Select all
<html>
<body>
<FORM action="circle.php" method="Post">
<TABLE BORDER CELLPADDING=3>
<!-- circumference and area of a circle -->
<TR BGCOLOR="#GGBBAA"><TD>Geometrical Shape</TD> <TD>Input Values </TD><TD> Results</TD></TR>
<TR>
<TH>Circumference and Radius of a Circle<BR><IMG SRC="/graphics/circle.gif" HEIGHT=88 WIDTH=88 ALT="picture of a circle"></TH>
<TD ALIGN=RIGHT <NOBR>radius: <INPUT NAME="circle_radius" SIZE=4></NOBR><BR>
<NOBR> <input type="reset" value="Reset" /></NOBR><BR>
<input type="submit" value="Calculate"/></TD>
<TD ALIGN=RIGHT BGCOLOR="#AACCFF">
<NOBR>circumference: <INPUT NAME="<?php echo $circle_circumference; ?>" SIZE=9></NOBR><BR>
<NOBR>area: <INPUT NAME=" <?php echo $circle_area; ?>" SIZE=9></NOBR></TD>
</FORM>
</TR>
</body>
</html>
and the code for circle.php is given below
--circle,php code---
<?php
$circle_radius=$_POST['circle_radius'];
if ($circle_radius >= 0)
{
$circle_circumference = 2 * 3.14286 * $circle_radius ;
}
else
{
$circle_circumference = "";
}
if ($circle_radius >= 0)
{
$circle_area = 3.14286 * $circle_radius * $circle_radius ;
}
else
{
$circle_area = "";
}
echo "Circle circumference=";echo $circle_circumference;
echo " and";
echo " Circle area=";echo $circle_area;
?>