Gan, Tentang POPUP di PHP

gan saya kan mau bikin tugas, jadi saya mau munculin popup jika bil2 kurang dari 30% dari bil1,

saya sudah coba2 tapii gagal :'(  bisa minta tolong, saya pakai php & html & css

<!DOCTYPE html>
<html>
<head>
    <title>Simulasi Kredit | UD.Abadi Motor Semarang</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <?php
    if(isset($_POST['hitung'])){
        $bil1 = $_POST['bil1'];
        $bil2 = $_POST['bil2'];
        $operasi = $_POST['operasi'];
        switch ($operasi) {
            case '12bulan':
                $hasil = $bil1-$bil2;
                $hasil1 = $hasil*0.03;
                $hasil2 = $hasil1+$hasil;
                $hasil3 = $hasil2/12;
            break;
            case '24bulan':
                $hasil = $bil1-$bil2;
                $hasil1 = $hasil*0.06;
                $hasil2 = $hasil1+$hasil;
                $hasil3 = $hasil2/24;
            break;
            case '36bulan':
                $hasil = $bil1-$bil2;
                $hasil1 = $hasil*0.09;
                $hasil2 = $hasil1+$hasil;
                $hasil3 = $hasil2/36;
            break;

            #case 'minimal':
            #   $bil_lanjut = $bil1*30/100;
            #break;
        }
    }
    #else($bil2 < $bil_lanjut) {
    #   echo"<script>alert('DP anda Kurang dari 30%');history.go(-1);</script>";
    #}
    ?>
    <div class="kalkulator">
        <h2 class="judul">SIMULASI KREDIT</h2>
        <form method="post" action="index.php">
            <input type="text" name="bil1" class="bil" autocomplete="off" placeholder="Harga OTR">
            <input type="text" name="bil2" class="bil" autocomplete="off" placeholder="DP - Minimal 30%">
            <select class="opt" name="operasi" placeholder="Tenor">
                <option value="12bulan">12 Bulan</option>
                <option value="24bulan">24 Bulan</option>
                <option value="36bulan">36 Bulan</option>

            </select>
            <input type="submit" name="hitung" value="Hitung" class="tombol">
        </form>
        <?php if(isset($_POST['hitung'])){ ?>
            <input type="text" value="<?php echo $hasil3; ?>" class="bil" placeholder="Hasil" disable>
        <?php }else{ ?>
            <input type="text" value="0" class="bil">
        <?php } ?>
    </div>
</body>
</html>
avatar ariyano
@ariyano

2 Kontribusi 0 Poin

Diperbarui 2 tahun yang lalu

Tanggapan

bisa sertakan script yang sudah kamu buat ? ? aku bisa aja ngasih full dari awal script nya,,, tapi nanti jadinya ga bantu tugas tapi buatin tugas 😅

Baca aturan main di forum ini ya, sertakan kode atau gambar jika perlu

2 Jawaban:

<div>mungkin kaya gini ya?<br><br>&nbsp;&lt;?php&nbsp;<br>&nbsp; &nbsp; $bil1 = $_POST['bil1'];<br>&nbsp; &nbsp; $bil2 = $_POST['bil2'];<br>&nbsp; &nbsp; $bil_lanjut = $bil130/100;<br><br>&nbsp; &nbsp; if(isset($_POST['hitung'])){<br>&nbsp; &nbsp; &nbsp; &nbsp; $operasi = $_POST['operasi'];<br>&nbsp; &nbsp; &nbsp; &nbsp; switch ($operasi) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '12bulan':<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil = $bil1-$bil2;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil1 = $hasil0.03;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil2 = $hasil1+$hasil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil3 = $hasil2/12;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '24bulan':<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil = $bil1-$bil2;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil1 = $hasil0.06;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil2 = $hasil1+$hasil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil3 = $hasil2/24;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '36bulan':<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil = $bil1-$bil2;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil1 = $hasil0.09;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil2 = $hasil1+$hasil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $hasil3 = $hasil2/36;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;&nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; if($bil2 &lt; $bil_lanjut) {<br>&nbsp; &nbsp; &nbsp; &nbsp; echo '&lt;script type="text/javascript"&gt;alert("DP anda Kurang dari 30%");history.go(-1);&lt;/script&gt;';<br>&nbsp; &nbsp; }</div><div> ?&gt;</div><div><br><br></div>

avatar IbnuHamzah404
@IbnuHamzah404

2 Kontribusi 0 Poin

Dipost 2 tahun yang lalu

<div><br>My dream residence could be very one of a kind from the usual house. i would love to introduce it to you if you are interested in it. <br>the shape of my dream residence like a strawberry; the roof if inexperienced, and walls are crimson. <br>let’s enter my dream house and look around: it consists of a dwelling-room, a observe-room, a bed room, and a bathroom. the wall of the bedroom is covered with mink, so that i'm able to sleep with a candy dream and sense extra at ease. there are lots of factors in my house ----which includes computers,televisions, telephones, tables, beds, and so on. of path, the cost of my dream residence may be very huge, too. <br>how can make my dream come real? we can understand it most effective by our hard operatingn。<br><a href="https://www.businessmenuguide.com/searchengine">bing image search</a></div>

avatar businessmenugui1
@businessmenugui1

1 Kontribusi 0 Poin

Dipost 2 tahun yang lalu

Login untuk ikut Jawaban