Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="" method="post">
- <h4>PROGRAM TARIF BUS</h4>
- Masukkan pilihan (1-3) <input type="text" name="pilihan" placeholder='0'>
- <br>
- Masukkan jumlah penumpang <input type="text" name="jumlah" placeholder='0'>
- <br>
- <input type="submit" name="hitung" value="Hitung">
- <br><br>
- <?php
- if (isset($_POST['hitung'])) {
- $pilihan = $_POST['pilihan'];
- $jumlah = $_POST['jumlah'];
- $harga = array(0,100000,150000,200000);
- if (($pilihan == 1) || ($pilihan == 2) || ($pilihan == 3))
- {
- $hasil = $harga[$pilihan] * $jumlah;
- } else {
- $hasil = 0;
- }
- }
- ?>
- Maka jumlah harga adalah: <b><?php echo isset($hasil) ? $hasil : '0' ?></b>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement