26 June 2012

Operasi Perkalian Untuk PHP

Berikut ini contoh Listing untuk Perkalian dengan PHP


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Menghitung Luas</title>
</head>

<body>
<form id="form1" name="form1" method="get" action="luas.php">
<table width="500" border="0">
<tr>
<td width="116">Panjang</td>
<td width="152"><input name="panjang" type="text" id="panjang" /></td>
<td width="218" rowspan="2"><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
</tr>
<tr>
<td>Lebar</td>
<td><label>
<input name="lebar" type="text" id="lebar" />
</label></td>
</tr>
<tr>
<td bgcolor="#00FFFF"><div align="center"><strong>Luas = </strong></div></td>
<td><?php
$panjang = $_GET['panjang'];
$lebar = $_GET["lebar"];
echo "$panjang x $lebar =";
?></td>
<td><?php
$panjang = $_GET['panjang'];
$lebar = $_GET["lebar"];
$luas = $panjang * $lebar;
echo "$luas";
?></td>
</tr>
</table>
</form>
</body>
</html>

No comments:

Post a Comment