Back to example ^

<?
$a 
$_REQUEST[a];
$b $_REQUEST[b];
if ( isset(
$a) && isset($b) )
{
$a_sqr $a*$a;
$b_sqr $b*$b;
$h $a_sqr $b_sqr;
$h sqrt($h);
}
?>

<html><body bgcolor="#fad888">
<form>
<center>
<table border="1">
<tr>
<td colspan="2">
Enter sides a & b of a<br />
right triangle to get<br />
the hypotenuse.
</td>
</tr>
<td align="center">a </td>
<td align="center"><input type="text" cols="5" name="a"  value="<? echo "$a"?>" />
</td>
</tr>
<tr>
<td align="center">b </td>
<td align="center"><input type="text" cols="5" name="b"  value="<? echo "$b"?>" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" /></td>
</tr>
<tr>
<td align="center">hypotenuse</td>
<td align="center"><input type="text" cols="5" name="h"  value="<? 
if ( isset($h) )
{ echo 
"$h"; } ?>" /></td>
</tr>
</table>
<a href="../">^</a> <a href="pythagoras_01_c.php">PHP source</a>
</center>
</form>
<? 
include("../../bottom.txt"); 
?>

</body></html>

Was this webpage useful to you? You can support this website by donating.


Created by DJ Mike from Santa Barbara

DJ Mike


<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>