Kamis, 05 Maret 2015

Tag: ,

Membuat Kalkulator Sederhana Dengan PHP



S.E.C kali ini akan memberi banyak tentang hal membuat kalkulator sederhana dengan perpaduan HTML dan PHP.

Berikut adalah tahapannya :
1.aktifkan XAMPP, jika belum punya bisa download disini
2. Buatlah file php dengan nama index.php lalu copy kode berikut
<!DOCTYPE html>
<head></head>
<body>
<div id="kontainer">
                <div id="header">KALKULATOR SEDERHANA</div>
    <div id="tengah" style="background-color:none;">
                <center><form action="hasil.php" method="POST">
                <table>
                <tr>
                <td>bilangan 1</td>
                <td>:</td>
                <td><input type="number" name="bil1"</td>
            </tr>
            <tr>
                <td>bilangan 2</td>
                <td>:</td>
                <td><input type="number" name="bil2"</td>
            </tr>
            <tr>
                <td colspan="2">
                                <input type="submit" name="tambah" value="+"/>
                    <input type="submit" name="kurang" value="-"/>
                    <input type="submit" name="kali" value="*"/>
                    <input type="submit" name="bagi" value="/"/>
                    <input type="reset" name="reset" value="reset"/>
                </td>
            </tr>
        </table>
    </form></center>
    </div>
</div>
 <div id="footer">&copy;CopyrightSEC-Faisal Budiman</div>
</body>
</html>
3 . Buatlah file php dengan nama hasil.php lalu copy kode berikut

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="kontainer">
                <div id="header">KALKULATOR SEDERHANA</div>
    <div id="tengah" style="background-color:none;">
                <center><form action="hasil.php" method="POST">
                <table>
                <tr>
                <td>bilangan 1</td>
                <td>:</td>
                <td><input type="number" name="bil1"</td>
            </tr>
            <tr>
                <td>bilangan 2</td>
                <td>:</td>
                <td><input type="number" name="bil2"</td>
            </tr>
            <tr>
                <td colspan="2">
                                <input type="submit" name="tambah" value="+"/>
                    <input type="submit" name="kurang" value="-"/>
                    <input type="submit" name="kali" value="*"/>
                    <input type="submit" name="bagi" value="/"/>
                    <input type="reset" name="reset" value="reset"/>
                </td>
            </tr>
        </table>
    </form></center>
    </div>
</div>
 <div id="footer">&copy;CopyrightSEC-Faisal Budiman</div>
</body>
</html>

4. Maka Hasilnya seperti berikut.

#note:background pilih sendiri




#note:background pilih sendiri

About Unknown

Hi, We Are Axle Group. We have a team of professinal programmers and developers work together.

0 komentar:

Posting Komentar

 

Ads