Selasa, 14 Desember 2010

Listing/code html+php Menggunakan Function

TUGAS 2 Web II (Teori)

Tampilan No. 1




Tampilan No.2




  1. <html>
    <head><title>Menghitung Luas Segi Tiga</title></head>
    <body>
    <form method ="POST">
    Masukan Alas Segitiga :
    <input type="text" name="alas"> m<br>
    Masukan Tinggi Segitiga:
    <input type="text" name="tinggi"> m<br>
    <input type="submit" name="proses" value="hitung">
    </form>
    <?php
    function Luas()
    {
        $a=$_POST['alas'];
        $t=$_POST['tinggi'];
        if(isset($_POST['proses']));
        {
            $l=0.5*$a*$t;
            echo "Luas Segitiga Adalah ".$l." m";
        }
    }
    Luas()
    ?>
    </body>
    </html>
  2. <?php
    function genap()
    {
        for($a=15;$a>=0;$a--)
            if ($a % 2 == 0)
            echo $a." ";
    }
        genap()
    ?>

Tidak ada komentar:

Posting Komentar