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”>
<td>Input Angka</td>
<input type=text name=”A”>
<td> &nbsp </td><td></td>
<td><Input Type=”Submit” value=”Ok”></td>

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

$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


Leave a Reply

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