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

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Haikal Putra Gustiansyah XI RPL 1 Nilai UN Study Kasus 1</title>
  5.     <link rel="stylesheet" type="text/css" href="css/nilai.css">
  6. </head>
  7. <body>
  8.     <form method="POST" action="total.php">
  9.         <table align="center">
  10.             <tr>
  11.                 <th colspan="2">SMKN 4 Bandung</th>
  12.             </tr>
  13.             <tr>
  14.                 <td>Nama</td>
  15.                 <td><input type="text" name="nama"></td>
  16.             </tr>
  17.             <tr>
  18.                 <td>Nilai B.Indonesia</td>
  19.                 <td><input type="text" name="bindo"></td>
  20.             </tr>
  21.             <tr>
  22.                 <td>Nilai Matematika</td>
  23.                 <td><input type="text" name="mtk"></td>
  24.             </tr>
  25.             <tr>
  26.                 <td>Nilai B.Inggris</td>
  27.                 <td><input type="text" name="inggris"></td>
  28.             </tr>
  29.             <tr>
  30.                 <td>Nilai Teori Kejuruan</td>
  31.                 <td><input type="text" name="jurusan"></td>
  32.             </tr>
  33.             <tr>
  34.                 <td></td>
  35.                 <td><input type="submit" name="submit"></td>
  36.             </tr>
  37.         </table>
  38.     </form>
  39.     
  40.     <?php 
  41.  $nama = $_POST['nama'];
  42.  $indo = (int)$_POST['bindo'];
  43.  $mtk = (int)$_POST['mtk'];
  44.  $inggris = (int)$_POST['inggris'];
  45.  $jurusan = (int)$_POST['jurusan'];
  46.  
  47.  echo "Nama Siswa  : " . $nama . "<br>";
  48.  echo "Nilai Total : ";
  49.  echo $indo + $mtk + $inggris + $jurusan;
  50.  ?>
  51. </body>
  52. </html>
File Description
  • nilai
  • PHP Code
  • 22 Oct-2019
  • 1.48 Kb
You can Share it: