Advertisement
Sythz

Untitled

Oct 2nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.51 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>Hanif Abyan Ayyasyi XI RPL 2</title>
  8.     <link rel="stylesheet" href="csssk3.css">
  9. </head>
  10. <body>
  11.     <form align="center" action="" method="post">
  12.         <table align = "center">
  13.         <tr>
  14.             <td>Masukan Kalimat : <input type="text" name="kalimat" id="kalimat"></td>
  15.             <td><input type="radio" name="char" id="char" value="a" >a</td>
  16.             <td><input type="radio" name="char" id="char" value="i">i</td>
  17.             <td><input type="radio" name="char" id="char" value="u">u</td>
  18.             <td><input type="radio" name="char" id="char" value="e">e</td>
  19.             <td><input type="radio" name="char" id="char" value="o">o</td>
  20.             <td><input type="submit" value="Kirim" name="submit" autocompalete="off"></td>
  21.         </tr>
  22.         </table>
  23.     </form>
  24.  
  25.     <?php
  26.        if (isset($_POST['submit'])) {
  27.            $kalimat = $_POST['kalimat'];
  28.            $char = $_POST['char'];
  29.            $jml = strlen($kalimat);
  30.            $a = 0;
  31.            $b = 0;
  32.            while ($a <= $jml) {
  33.                if (substr($kalimat,$a,1) == $char  ) {
  34.                    $b = $b+1;
  35.                }
  36.                $a++;
  37.            }
  38.            echo " <p align='center'>Jumlah huruf $char berjumlah $b </p>";
  39.         }
  40.        
  41.     ?>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement