How to Make Multiplication PHP Simple Application Tutorial, Free Edision, simple Ebook.
This time I will give a free PHP tutorial.
We will make an application Multiplication PHP Simple Application Tutorial, ie a rectangular area calculation.
With the formula Nilai1 X Nilai2
We put the formula into PHP.
Code:
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><form id="form1" name="form1" method="post" action=""><table width="43%" border="1" align="center"><tr><td width="20%">Nilai 1 </td><td width="51%">:<input name="long" type="text" id="long" /></td><td width="29%" rowspan="3">Total :</td></tr><tr><td>Nilai 2 </td><td>:<input name="width" type="text" id="width" /></td></tr><tr><td> </td><td><div align="center"><input type="submit" name="Submit" value="Submit" /></div></td></tr></table></form></body></html>
Then add the following php script to read and calculate the value or number that we enter.
Code:
<?php
$long = $_POST["long"];
$width = $_POST["width"];
$total = $long*$width;
echo $total;
?>
to be like this
Code:
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><form id="form1" name="form1" method="post" action=""><table width="43%" border="1" align="center"><tr><td width="20%">Nilai 1 </td><td width="51%">:<input name="long" type="text" id="long" /></td><td width="29%" rowspan="3">Total :<?php$long = $_POST["long"];$width = $_POST["width"];$total = $long*$width;echo $total;?> </td></tr><tr><td>Nilai 2 </td><td>:<input name="width" type="text" id="width" /></td></tr><tr><td> </td><td><div align="center"><input type="submit" name="Submit" value="Submit" /></div></td></tr></table></form></body></html>
Finish