regra - 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 regra.php

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Syarif Hidayat Registrasi</title>
  5.     <link rel="stylesheet" type="text/css" href="css/register.css">
  6. </head>
  7. <body>
  8.     <form action="register.php" method="POST">
  9.     <table  align="center">
  10.         <tr>
  11.             <th colspan="4">REGISTRASI</th>
  12.         </tr>
  13.         <tr>
  14.             <td>Nama</td>
  15.             <td><input type="text" name="nd"></td>
  16.             <td>Nama Belakang</td>
  17.             <td><input type="text" name="nb"></td>
  18.         </tr>
  19.         <tr>
  20.             <td>Tempat,Tanggal,Lahir</td>
  21.             <td><input type="text" name="ttl"></td>
  22.         </tr>
  23.         <tr>
  24.             <td>Jenis Kelamin</td>
  25.             <td><input type="radio" name="jkelamin" value="Pria">Pria<input type="radio" name="jkelamin" value="Wanita">Wanita</td>
  26.         </tr>
  27.         <tr>
  28.             <td>Agama</td>
  29.             <td>
  30.                 <select name="agama">
  31.                     <option value="Islam">Islam</option>
  32.                     <option value="Protestan">Protestan</option>
  33.                     <option value="Katolik">Katolik</option>
  34.                     <option value="Buddha">Buddha</option>
  35.                     <option value="Hindu">Hindu</option>
  36.                     <option value="Konghucu">Konghucu</option>
  37.                 </select>
  38.             </td>
  39.         </tr>
  40.         <tr>
  41.             <td>Alamat</td>
  42.             <td><textarea cols="20" rows="3" name="alamat"></textarea></td>
  43.         </tr>
  44.         <tr>
  45.             <td></td>
  46.             <td><input type="submit" name="submit"></td>
  47.         </tr>
  48.     </table>
  49.     </form>
  50.     
  51.     <?php 
  52.  $nd = $_POST['nd'];
  53.  $nb = $_POST['nb'];
  54.  $ttl = $_POST['ttl'];
  55.  $jkelamin = $_POST['jkelamin'];
  56.  $agama = $_POST['agama'];
  57.  $alamat = $_POST['alamat'];
  58.  
  59.  echo 'Selamat datang '.$nd . ' ' .$nb . ',anda telah berhasil daftar. Data diri anda:' ."<br>";
  60.  echo 'Tempat,tanggal,lahir :'.$ttl. "<br>";
  61.  echo 'Jenis Kelamin'.$jkelamin. "<br>";
  62.  echo 'Agana :'.$agama. "<br>";
  63.  echo 'Alamat :'.$alamat;
  64.  ?>
  65. </body>
  66. </html>
File Description
  • regra
  • PHP Code
  • 22 Oct-2019
  • 1.97 Kb
You can Share it: