for - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of for.php

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  <title>Studi Kasus For</title>
  5.  <style>
  6.   body{
  7.    background-color: gray;
  8.    font-family: cursive;
  9.   }
  10.   input{
  11.    border-radius: 5px;
  12.   }
  13.   button{
  14.    background-color: yellow;
  15.    border: 1px solid black;
  16.    color: black;
  17.   }
  18.  
  19.  
  20.  </style>
  21. </head>
  22. <body>
  23.  <div class="inputan">
  24.  <form action="" method="post">
  25.  
  26.  <h1>
  27. Form Input Data Siswa</h1>
  28. Masukkan jumlah siswa <input type="text" name="jumlah">
  29.  <button type="submit">Enter</button>
  30.  </form>
  31. <br>
  32.  </div>
  33. <table cellspacing="0" cellpadding="2" border="1">
  34. <tr>
  35.    <th>No</th>
  36.    <th>Nis</th>
  37.    <th>Nama</th>
  38.    <th>Alamat</th>
  39.   </tr>
  40. <?php
  41.   $jumlah = (int)$_POST['jumlah'];
  42.   for($i=1;$i<=$jumlah;$i++){
  43.   echo <<<aw
  44. <tr>
  45.     <td><input type="text" name="" value=$i></td>
  46.     <td><input type="text" name=""></td>
  47.     <td><input type="text" name=""></td>
  48.     <td><input type="text" name=""></td>
  49.    </tr>
  50. aw;
  51.  
  52.   
  53.  
  54.   }
  55.   ?>
  56.  </table>
  57. </body>
  58. </html>
File Description
  • for
  • PHP Code
  • 29 Oct-2019
  • 994 Bytes
You can Share it: