| | |
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
Views: 1175 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database dataentry date directory display download dynamic echo email error file files firstoptioninphpdroplist folder form forms freelancing function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap sorting source space speed sql structure syntax system table tutorial tutorials update upload url validation validator variable video web white xml youtube zend





