Advertisement
Rofihimam

Untitled

Oct 1st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. <link href="https://fonts.googleapis.com/css?family=Bree+Serif&display=swap" rel="stylesheet">
  2. <style type="text/css">
  3.     h1{
  4.         font-family: 'Bree Serif', serif;
  5.         color: blue;
  6.     }
  7.     p{
  8.         font-family: 'Bree Serif', serif;
  9.         color: blue;
  10.     }
  11.     p.hasil{
  12.         font-family: 'Bree Serif', serif;
  13.         color: black;
  14.     }
  15.     input#kalimat{
  16.         border: 2px inset black;
  17.         background: linear-gradient(to bottom, #0033cc 0%, #ff0066 100%);
  18.         font-family: 'Bree Serif', serif;
  19.         font-size: 15px;
  20.         border-radius: 50px;
  21.         text-align: center;
  22.         width: 300px;
  23.     }
  24.     input#button{
  25.         border: 3px outset blue;
  26.         background-color: silver;
  27.         font-family: 'Bree Serif', serif;
  28.         transition-duration: 0.5s;
  29.         font-size: 15px;
  30.         border-radius: 50px;
  31.     }
  32.     input#button:hover{
  33.         border: 3px outset blue;
  34.         background: linear-gradient(to bottom, #0033cc 0%, #ff0066 100%);
  35.         font-family: 'Bree Serif', serif;
  36.         font-size: 17px;
  37.         border-radius: 50px;
  38.         color: white;
  39.     }
  40. </style>
  41.  
  42. <h1>Hitung Jumlah Huruf</h1>
  43. <form id="jumlahHuruf" name="jumlahHuruf" method="post">
  44.     <p>
  45.         Masukkan Kalimat :
  46.         <input type="text" name="kalimat" id="kalimat" autocomplete="off" required="">
  47.         <input type="radio" name="huruf" value="a">a
  48.         <input type="radio" name="huruf" value="i">i
  49.         <input type="radio" name="huruf" value="u">u
  50.         <input type="radio" name="huruf" value="e">e
  51.         <input type="radio" name="huruf" value="o">o
  52.         <input type="submit" name="button" id="button" value="Hitung">
  53.     </p>
  54. </form>
  55.  
  56. <p class="hasil">
  57. <?php
  58. if (isset($_POST['button'])) {
  59.     $kalimat = $_POST['kalimat'];
  60.     $huruf = $_POST['huruf'];
  61.     $length = strlen($kalimat);
  62.  
  63.     echo "Jumlah huruf \"<b>$huruf</b>\" dari kalimat \"<b>$kalimat</b>\" adalah ". substr_count($kalimat, $huruf);
  64. }
  65. ?>
  66. </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement