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

  1. <?php
  2. // Message Vars
  3. $msg = '';
  4. $msgClass = '';
  5. // Check For Submit
  6. if (filter_has_var(INPUT_POST 'submit')) {
  7.         echo "Submitted";
  8.         $name = $_POST['name'];
  9.         $email = $_POST['email'];
  10.         $message = $_POST['message'];
  11.  
  12.         // Check Req
  13.  
  14. if (!empty)/$email && !empty($name) && !empty($message){
  15.         // passes...
  16.         echo 'PASSED';
  17. }else {
  18.         //failed...
  19.         $msg = 'Du skal udfylde alle 3 felter';
  20.         $msgClass = 'aller-danger';
  21. }
  22. }
  23. ?>
  24.  
  25. <!DOCTYPE html>
  26. <html lang="en">
  27. <head>
  28.         <meta charset="UTF-8">
  29.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  30.         <meta name="description" content="Billig grafisk designer til dit behov og dine ønsker.
  31.         Vi bygger porfesionelt i HRML & css">
  32.         <meta name="keywords" content="bilig designer, Web design, Bilig web desinger, designer skole,
  33.         hvordan laver man en hjemmeside, Hjemmeside, WebDesign, Grafisk designer">
  34.         <title>GGTECH - Designs til dit behov</title>
  35.         <link rel="stylesheet" href="./css/style.css">
  36. </head>
  37. <body>
  38.  
  39.         <section id="section-1">
  40.  
  41.  
  42.                 <div class="container">
  43.  
  44.                         <header>
  45.                                 <img src="./images/gglogo.png">
  46.  
  47.                                 <nav>
  48.                                         <ul>
  49.                                                 <li><a href="index.php">HJEM</a></li>
  50.                                                 <li><a href="portfolie.php">PORTFOLIE</a></li>
  51.                                         </ul>
  52.                                 </nav>
  53.                         </header>
  54.  
  55.                         <div class="content">
  56.                                 <h1>Hvad Kan vi gøre for dig ?</h1>
  57.                                 <p>Vi opbygger din hjemmeside</p>
  58.                         </div>
  59.  
  60.                 </div>
  61.  
  62.  
  63.  
  64.         </section>
  65.  
  66.         <section id="section-2">
  67.  
  68.                 <div class="container">
  69.  
  70.                         <div class="over">
  71.                                 <h1>process ?</h1>
  72.                         </div>
  73.  
  74.                         <div id="blurbs">
  75.  
  76.                                 <div class="blurb">
  77.                                         <img class="blurbic" src="./images/logo_html.png">
  78.                                         <h1>vi bygger i html</h1>
  79.                                         <p>ALLE VORES HJEMMESIDER
  80.                                                 BLIVER BYGGET I HTML</p>
  81.                                 </div>
  82.  
  83.                                 <div class="blurb">
  84.                                         <img class="blurbic" src="./images/logo_css.png">
  85.                                         <h1>vi designer i css</h1>
  86.                                         <p>ALLE VORES HJEMMESIDER
  87.                                                 BLIVER DESIGNET I CSS</p>
  88.                                 </div>
  89.  
  90.                                 <div class="blurb">
  91.                                         <img class="blurbic" src="./images/logo_brush.png">
  92.                                         <h1>vi hoster selv</h1>
  93.                                         <p>ALLE VORES HJEMMESIDER
  94.                                                 BLIVER HOSTED GENNEM OS</p>
  95.                                 </div>
  96.                         </div>
  97.  
  98.  
  99.                 </div>
  100.  
  101.         </section>
  102.  
  103.         <section id="section-3">
  104.  
  105.                 <div class="container">
  106.  
  107.                         <div class="content">
  108.                                 <h1>Kontak os nu</h1>
  109.                                 <p>Vi ser frem til en mail fra dig</p>
  110.                         </div>
  111.  
  112.  
  113.  
  114.                                                 <?php if($message !''): ?>
  115.                                                         <div class="alert <?php echo $msgClass; ?>"
  116.                                                                 <<?php echo $msg; ?>
  117.                                                         </div>
  118.                                                 <?php endif ?>
  119.  
  120.  
  121.  
  122.  
  123.  
  124.                         <form id="contact-form" method="post" action=">?php echo $_SERVER['PHP_SELF'];?>">
  125.  
  126.                                 <div class="form-row">
  127.                                         <input type="text" name="name" placeholder="Dit Name" required>
  128.                                         <input type="text" name="email"placeholder="Din Email" required>
  129.                                 </div>
  130.  
  131.                                 <div class="form-row">
  132.                                         <textarea name="message" placeholder="Din besked" required></textarea>
  133.                                 </div>
  134.  
  135.                                 <div class="form-row">
  136.                                         <input type="submit" class="big-button" value="Send besked">
  137.                                 </div>
  138.                         </form>
  139.  
  140.                 </div>
  141.  
  142.         </section>
  143.  
  144.         <footer>
  145.  
  146.                 <div class="container">
  147.                         <div class="copy">
  148.                                 <p>GGTECH, Copyright ©2020</p>
  149.                         </div>
  150.  
  151.                 </div>
  152.         </footer>
  153.  
  154.  
  155.  
  156. </body>
  157. </html>
  158.  
File Description
  • TEST
  • PHP Code
  • 27 Oct-2020
  • 3.15 Kb
You can Share it: