Multiplication applications with PHP




How to Make multiple applications with PHP

This time I will give a free PHP tutorial.
We will make an application simple multiplication, ie a rectangular area calculation.

With the formula Length X Width

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="45%" border="1" align="center">
    <tr>
      <td width="20%">Long</td>
      <td width="62%">:
        <input name="long" type="text" id="long" /></td>
      <td width="18%" rowspan="3">Total :
 </td>
    </tr>
    <tr>
      <td>Width</td>
      <td>:
        <input name="width" type="text" id="width" /></td>
    </tr>
    <tr>
      <td>&nbsp;</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="45%" border="1" align="center">
    <tr>
      <td width="20%">Long</td>
      <td width="62%">:
        <input name="long" type="text" id="long" /></td>
      <td width="18%" rowspan="3">Total :
<?php
  $long = $_POST["long"];
  $width = $_POST["width"];
  $total = $long*$width;
  echo $total;
  ?>

 </td>
    </tr>
    <tr>
      <td>Width</td>
      <td>:
        <input name="width" type="text" id="width" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><div align="center">
        <input type="submit" name="Submit" value="Submit" />
      </div></td>
    </tr>
  </table>
</form>
</body>
</html>
Finish

Comments :

0 komentar to “Multiplication applications with PHP”

Posting Komentar

Advertisement:

Blog :