Current location: Hot Scripts Forums » HotScripts.com Discussion » Hot Scripts Forum Questions, Suggestions and Feedback » display form results on the same html page


display form results on the same html page

Reply
  #1 (permalink)  
Old 10-04-11, 05:48 AM
skahmad skahmad is offline
New Member
 
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question display form results on the same html page

Hi! I am new to PHP.
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--
<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;
?>
Reply With Quote
Reply

Bookmarks

Tags
form, html, php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Above Form xavier039 CSS 1 07-13-09 10:52 PM
Javascript & HTML Form... Guru Needed Stick JavaScript 0 05-30-08 03:20 PM
Submit form values upon redirecting a page dips JavaScript 2 03-27-07 11:44 PM
[turnkey] Lyrics site - $149 (LEGAL) rightinpoint General Advertisements 0 10-22-06 04:33 AM
checkCheckboxGroup broken after form consolidation ski_woman JavaScript 0 01-12-05 11:00 AM


All times are GMT -5. The time now is 09:59 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.