Minggu, 05 Oktober 2014

Php ganjil dan genap

Welcome

this opportunity to share my php script determines the number of odd and even
on a number,
at the time the number is inputted php reads and displays the inputted number is an odd number or even number.
so the basic php.

thank you for visiting




<?php
@$nilai1 = $_POST['nilai1'];
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <form action="#" method="POST">
            <table>
                <h1>Menentukan bilangan ganjil dan genap</h1>
                <tr>
                    <td>Masukkan angka</td>
                    <td>:</td>
                    <td><input type="number" name="nilai1" value="<?php echo $nilai1; ?>"/></td>
                </tr>
                <tr>
                        <td></td>
                        <td></td>
                        <td><input type="submit" name="proses" value="Kirim"/></td>
                    </tr>
                </table>
            </form>
        </body>
    </html>
    <?php
        if($nilai1%2==0){
            echo "bilangan yang diinput adalah genap" ;
        }else{
            echo"bilangan yang diinput adalah ganjil";
        }

    ?>

Tidak ada komentar:

Posting Komentar