Minggu, 05 Oktober 2014

PHP Positif dan Negatif

basic php this time is to determine the number of positive and negative numbers
numbers are inputted and processed using php script then
displayed if the number is a positive number or a negative number
following his script



<?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 Negatif dan Positif</h1>
                <tr>
                    <td>Masukkan angka</td>
                    <td>:</td>
                    <td><input type="text" 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 < 0){
            echo "bilangan yang diinput adalah negatif" ;
        }else{
            echo"bilangan yang diinput adalah positif";
        }

    ?>

Tidak ada komentar:

Posting Komentar