Hi People
This PHP Application is for generating a Trigonometric Table for Sine, Cosine and Tangent Values.
In this we have a HTML form where the user need to enter the Range of Degrees for which she wants to generate a Trigonometric Table.
This Numbers are send as parameters in a PHP page which produces the Table.
PHP Math Functions have been used to find the values
sin(), cos(), tan() functions have been used to find the respective values.
TrigoTableForm.html
<html>
<head>
<title> Trigonometric Table Generator Form</title>
<style type="text/css">
/*Style for Table*/
table
{
font-family:Arial; font-size:15px;
color:navy; font-weight: normal;
border: 1px solid red;
text-align: center;
border-collapse:collapse; width:30%;
}
h2
{
font-family:Arial; font-size:25px;
color: red; font-weight: bold;
text-decoration:underline
}
</style>
</head>
<body>
<h2> Trigonometric Table Generator </h2>
<form action="TrigoTable.php" method="post">
<table border="0" cellpadding="10">
<tr>
<td> From: </td>
<td> <input type="textbox" name="fangle"> </td>
</tr>
<tr>
<td> To: </td>
<td> <input type="textbox" name="tangle"></td>
</tr>
<tr>
<td> Interval: </td>
<td> <input type="textbox" name="interval"></td>
</tr>
<tr>
<td colspan="2" align="center"> <br /> <br />
<input type="submit" value="Submit">
<input type="reset" value="Reset"></td>
</tr>
</table>
*Acceptable range is from 0 to 360 degrees.
</form>
</body>
</html>
Snapshot of the o/p

TrigoTable.php
<html>
<head>
<title>Trigonometric Table</title>
<style type="text/css">
/*Style for Table*/
table
{
font-family:Arial; font-size:15px;
color:navy; font-weight: normal;
border: 1px solid navy;
text-align: center;
border-collapse:collapse; width:30%;
}
th
{
font-family:Arial; font-size:16px;
color:black; font-weight: bold;
text-align: center;
}
td
{
height:35px;
}
/*Style for The Heading*/
h2
{
font-family:Arial; font-size:20px;
color: blue; font-weight: bold; text-align: center;
text-decoration:underline
}
</style>
</head>
<body>
<?php
$fangle=$_POST['fangle'];
$tangle=$_POST['tangle'];
$interval=$_POST['interval'];
if ($fangle>$tangle || $fangle>360 || $fangle<0 || $tangle<=0 || $tangle>360)
echo "Valid range is 0 to 360, please enter the correct range.";
else if($interval<=0 || $interval>360 || $interval>$tangle)
echo "Interval entered is invalid.Please enter the correct interval.";
else
{
echo "<table border='1' align='center' bgcolor='#E0FFFF' cellpadding='10'>";
echo "<tr>";
echo " <td align='center' colspan='4' bgcolor='#87CEEB'><h2>Trigonometic Table</h2></td>";
echo "</tr>";
echo "<tr>";
echo "<th>Degree</th>";
echo "<th>Sine</th>";
echo "<th>Cosine</th>";
echo "<th>Tangent</th>";
echo "</tr>";
for($i=$fangle;$i<=$tangle;$i+=$interval)
{
$sine=sin(deg2rad($i));
$cosine=cos(deg2rad($i));
if($cosine==0)
$tangent="Infinity";
else
$tangent=tan(deg2rad($i));
echo "<tr>";
echo "<td>$i</td>";
echo "<td>$sine</td>";
echo "<td>$cosine</td>";
echo "<td>$tangent</td>";
echo "</tr>";
}
echo "</table>";
}
?>
</body>
</html>
Snapshot of the o/p




