IIC University of Technology Evening Class (B205)
filename: func.php
formfunc.php
formfunc.php
<?php include("func.php"); if(isset($_GET['btncal'])){ echo "My Add is". add($_GET['txtx'],$_GET['txty']); echo "<br>"; echo "My Sub is". sub($_GET['txtx'],$_GET['txty']); } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <form method="get"> X:<input type="text" name="txtx" /> Y:<input type="text" name="txty" /> <input type="submit" name="btncal" /> </form> <body> </body> </html>
func.php
<?php function add($x,$y){ $total = $x + $y; return $total; } function sub($x,$y){ $sub = $x - $y; return $sub; } ?>