i am new to php and need some help. i have 2 pages one is html and other is .php
when i run the program it just spits out the code. i am stumped
here is the html file
<html>
<Head>
<title>Triangle </title>
</head>
<body>
<form action="triangl e.php" method="POST">
<p>
sideone:<input type="text" name="a" />
sidetwo:<input type="text" name="b" />
sidethree:<inpu t type="text" name="c" />
<input type="submit" />
</p>
</form>
</body>
</html>
here is the php
<html>
<head>
<title>Triangle </title>
</head>
<body>
<?php
function calculate($firs tside,$secondsi de,$thirdside)
{
$firstside=$_PO ST["a"];
$secondside=$_P OST["b"];
$thirdside=$_PO ST["c"];
$total = ($firstside + $secondside);
if ($total > $thirdside)
{
echo "(you have the correct side lengths)";
}
else
{
echo "(please re-enter the side lenghts)";
}
}
calculate("firs tside","seconds ide","thirdside ");
?>
</body>
</html>
when i run the program it just spits out the code. i am stumped
here is the html file
<html>
<Head>
<title>Triangle </title>
</head>
<body>
<form action="triangl e.php" method="POST">
<p>
sideone:<input type="text" name="a" />
sidetwo:<input type="text" name="b" />
sidethree:<inpu t type="text" name="c" />
<input type="submit" />
</p>
</form>
</body>
</html>
here is the php
<html>
<head>
<title>Triangle </title>
</head>
<body>
<?php
function calculate($firs tside,$secondsi de,$thirdside)
{
$firstside=$_PO ST["a"];
$secondside=$_P OST["b"];
$thirdside=$_PO ST["c"];
$total = ($firstside + $secondside);
if ($total > $thirdside)
{
echo "(you have the correct side lengths)";
}
else
{
echo "(please re-enter the side lenghts)";
}
}
calculate("firs tside","seconds ide","thirdside ");
?>
</body>
</html>
Comment