Belajar PHP

This is blog study PHP ..

1. First I will create an HTML form to input A (number)

<form action=”genapganjil.php” method=”POST”>
<table>
<tr>
<td>Input Angka</td>
<td>:</td>
<td>
<input type=text name=”A”>
</td>
</tr>
<tr>
<td> &nbsp </td><td></td>
<td><Input Type=”Submit” value=”Ok”></td>
</tr>
</table>
</form>

2. My second would create a php form using the if and else statements

<?php
$angka = $_POST[“A”];  //take the contents of the textbox and insert into variable rate
if (($angka % 2) == 0) {  //if the numbers divided by 2 result 0
echo $angka.” adalah bilangan genap”; //print numbers and the numbers are Bilangan Genap
} else
echo $angka.” adalah bilangan ganjil”; //print numbers and the numbers are bilangan ganjil
?>
 3. The second store above code with odd names and look at the browser genapganjil.php

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *