| | |
PhP scripting help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2005
Posts: 3
Reputation:
Solved Threads: 0
can any one help me with this script I am just gettin started with PHP
I am trying to create an calculation script that would
calculate the
Constant: PI = 3.1415926535
Radius, area, and circumference of a circle .
This is what I have dont so far but just cant seem to get it working
can some one tell me what i am doing wrong
<html>
<head>
<title>
Calculation Form
</title>
</head>
<body>
<form method="post" action="circumference.php">
<p>Rad:<input type="text" name="radius=" size=10></p>
<p><input type="submit" name="submit" value="calculate"></p>
</form>
</body>
</html>
PHP Script
<? php
if (!isset($_POST['submit'])) {
echo '<form action="' . $_SERVER['PHP_SELF'] . '" . method="post">' .
'<input type="text" name="radius" />' .
'<input type="submit" name="submit" value="Calculate" />' .
'</form>';
} else {
$circumference = M_PI * $_POST['radius'] * 2;
$area = M_PI * pow($_POST['radius'], 2);
echo 'Circumference = ' . $circumference . ' units<br />';
echo 'Area = ' . $area . ' sq. units<br />';
}
?>
<html>
<head>
<title></title>
</head>
<body>
<p> This result of the is : <? echo "$result" ; ?></p>
</body>
</html>
Thanks
I am trying to create an calculation script that would
calculate the
Constant: PI = 3.1415926535
Radius, area, and circumference of a circle .
This is what I have dont so far but just cant seem to get it working
can some one tell me what i am doing wrong
<html>
<head>
<title>
Calculation Form
</title>
</head>
<body>
<form method="post" action="circumference.php">
<p>Rad:<input type="text" name="radius=" size=10></p>
<p><input type="submit" name="submit" value="calculate"></p>
</form>
</body>
</html>
PHP Script
<? php
if (!isset($_POST['submit'])) {
echo '<form action="' . $_SERVER['PHP_SELF'] . '" . method="post">' .
'<input type="text" name="radius" />' .
'<input type="submit" name="submit" value="Calculate" />' .
'</form>';
} else {
$circumference = M_PI * $_POST['radius'] * 2;
$area = M_PI * pow($_POST['radius'], 2);
echo 'Circumference = ' . $circumference . ' units<br />';
echo 'Area = ' . $area . ' sq. units<br />';
}
?>
<html>
<head>
<title></title>
</head>
<body>
<p> This result of the is : <? echo "$result" ; ?></p>
</body>
</html>
Thanks
![]() |
Similar Threads
- Apache (Linux Servers and Apache)
- PhP scripting help please (PHP)
- November 2004 Contest: PHP Scripting (Web Development Job Offers)
- Good PHP Tutorial (PHP)
Other Threads in the PHP Forum
- Previous Thread: PHP-MySQL retrieval or getting data
- Next Thread: Desperate Again Please HELP PHP
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





