All pastes #68150 Raw Edit

Miscellany

public text v1 · immutable
#68150 ·published 2006-06-21 02:18 UTC
rendered paste body
<?php #All code copyleft to humanity, GPLv3 and higher. . . Hail Stallman.  

$d_or_r=$_POST['post'];

if ( $d_or_r != null )  { 

function do_cell ( $trig_funct )   { 
	global $i; 

	if ( is_string  ($trig_funct)  )  {

		printf ( "<td><center><b>%s</b></center></td>\n", $trig_funct); 
	} 

	else   { 

		printf ( "<td><center><b>%s</b></center></td>\n", round ( $trig_funct, 5) );  
		
		}
	}	



echo "<html><title>Custom Trig Table.</title><center><body><table border=\"1\" cellpadding=\"6\"><tr>";

do_cell ( $d_or_r ); 
do_cell(Sine);
do_cell(Cosine);
do_cell(Tangent);

for ($i= 0; $i <= 360; $i = $i+15) {
	echo "<tr>";	
	if ( $d_or_r=="Radians" ) { 
		echo("<td><center><img src=\"pi/img$i.gif\"></td></center>\n"); } #Line 12 please stop fueling my silent rage.

#if($d_or_r=="Radians") {	do_cell('<img src=\"pi/img"$i".gif\">');} #I'll fix this later.

	else	{ do_cell ($i); }				   

	$i = deg2rad($i);
			
	do_cell ( sin ($i) );
	do_cell ( cos ($i) );

	if(rad2deg($i)==90 or rad2deg($i)==270) { 
		do_cell(undefined); 
}

	else { do_cell (tan ($i) ); 
}
		
$i = rad2deg($i);
	
echo "</tr>";
}

echo "</table></body></center></html>"; 

}

else {
?>

<html>
<body>
	<form action="trig_custom.php" method="POST">

<font size="32">Would you like Radians or Degrees?</font><br><br><br><br>


		<input type="radio" name="post" value="Degrees">	
			
			Degrees.

<br><br><br>
			
		<input type="radio" name="post" value="Radians">

			Radians are cool.

<br><br><br>

		<input type="submit"  value="Show me the table."

	</form>
</body>
</html>
<?php } ?>