Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Kasus 3</title>
- <style type="text/css">
- body{
- background-color: yellow;
- }
- input[type="text"]{
- border-radius: 4px;
- background-color: silver;
- }
- input[type="text"]:focus{
- background-color: white;
- transition: 0.5s;
- }
- input.button{
- color: black;
- background: orange;
- border: 2px #191919 outset;
- padding: 5px 20px;
- font-size: 14px;
- transition: 0.4s;
- border-radius: 6px;
- }
- input.button:hover{
- color: orange;
- background: #191919;
- background: black;
- }
- </style>
- </head>
- <body>
- <h1>Hitung Jumlah Huruf</h1>
- <form name="" id="" method="post" action="">
- <p>Masukkan Kalimat
- <input type="text" name="kalimat" autocomplete="off">
- <input type="radio" name="huruf" value="a">a
- <input type="radio" name="huruf" value="i">i
- <input type="radio" name="huruf" value="u">u
- <input type="radio" name="huruf" value="e">e
- <input type="radio" name="huruf" value="o">o
- <input class="button" type="submit" name="submit" value="Hitung">
- </p>
- <?php
- $kalimat = $_POST['kalimat'];
- $huruf = $_POST['huruf'];
- $a=0;
- $jumlah=0;
- while ($a <= strlen($kalimat)) {
- if ($kalimat[$a] == $huruf) {
- $jumlah++;
- }
- $a++;
- }
- ?>
- <?php
- echo "<p>Jumlah Huruf '$huruf' pada kalimat '$kalimat' adalah $jumlah</p>";
- ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement