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

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Syarif Hidayat</title>
  5.     <link rel="stylesheet" type="text/css" href="css/penulis.css">
  6. </head>
  7. <body>
  8.     <form method="POST" action="timetime.php" >
  9.         <table align="center">
  10.             <tr>
  11.                 <td>Penulis</td>
  12.                 <td><input type="text" name="penulis"></td>
  13.             </tr>
  14.             <tr>
  15.                 <td>Judul Berita</td>
  16.                 <td><input type="text" name="judul"></td>
  17.             </tr>
  18.             <tr>
  19.                 <td>Isi berita</td>
  20.                 <td><textarea name="isi" cols="20" rows="10"></textarea></td>
  21.             </tr>
  22.             <tr>
  23.                 <td></td>
  24.                 <td><button type="submit">Posting</button></td>
  25.             </tr>
  26.         </table>
  27.     </form>
  28.     
  29.     
  30. <?php 
  31.  $date = date('Y-m-d H:i:s');
  32.  
  33.  $penulis = $_POST['penulis'];
  34.  $judul  = $_POST['judul'];
  35.  $isi = $_POST['isi'];
  36.  
  37.  ?>
  38. <!DOCTYPE html>
  39. <html>
  40. <head>
  41.  <title><?= $judul?></title>
  42.  <link rel="stylesheet" type="text/css" href="css/koten.css">
  43. </head>
  44. <body>
  45.  <div class="container">
  46.    <h1>
  47. <?= $judul ?></h1>
  48. <pre>Post:<?= $date ?></pre>
  49. <pre>Penulis: <?= $penulis ?></pre>
  50. <div class="konten">
  51. <br>
  52.    <p>
  53. <?= $isi ?></p>
  54. </div>
  55. </div>
  56. </body>
  57. </html>
  58.  
  59. </body>
  60. </html>
File Description
  • posting
  • PHP Code
  • 22 Oct-2019
  • 1.3 Kb
You can Share it: