E4_Grundstück - 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 E4_Grundstück.php

  1. <!DOCTYPE html> 
  2. <html lang="de">
  3. <head>
  4.         <meta charset="utf-8" />
  5.         <title>E4_Grundstück</title>
  6. </head>
  7.     
  8. <body>
  9. <?php
  10. if (isset ( $_POST [" "] )) {
  11.         $l = $_POST ["l"];
  12.         $b = $_POST ["b"];
  13.         $s = $_POST ["preis"];
  14.  
  15.     echo "<h1>Grundstückspreise</h1>";
  16.     echo "Länge:         ".$l.     "Meter";
  17.     echo "Breite:        ".$b.     "Meter";
  18.     echo "Preis:         ".$preis. "pro m²";
  19.  
  20. //Grundstückspreis
  21.     $nettopr = $l*$b*$preis;
  22.     echo "Nettopreis:    ".$nettopreis. "€";
  23.  
  24. //Preis mit Provision
  25.     $provpr = $nettopr+($nettopr*$prov/100);
  26.     echo "mit Provision: ".$provpr. "€";
  27.     
  28. if ($mwst==TRUE){
  29.     $bruttopr = $provpr*1.19;
  30.     }
  31. else {
  32.     $bruttopr = $nettopr;
  33.     } 
  34.     echo "Bruttopreis:   ".$bruttopr. "€";
  35. }
  36.  
  37. ?>
  38. <fieldset>
  39. <form method="post">
  40. <h1>Grundstückspreise</h1>
  41.     <p>
  42.                         <label for="l">Länge in m: </label> <input type="Länge:" name="l"
  43.             required placeholder=" Länge" autofocus />
  44.     </p>
  45.     <p>
  46.                         <label for="b">Breite in m: </label> <input type="Breite" name="b"
  47.             required placeholder=" Breite" />
  48.     </p>
  49.     <p>
  50.                         <label for="preis">Preis pro m²: </label> <input type="Preis" name="preis"
  51.             required placeholder=" Preis" />
  52.     </p>
  53. </form> 
  54.     
  55.     <p>
  56.         <label for="prov">Provisionssatz:</label>
  57.         <select id="prov" name="prov">
  58.                <option value="3">3%</option>
  59.             <option value="4">4%</option> 
  60.             <option value="5">5%</option>
  61.             <option value="6">6%</option>
  62.             <option value="7">7%</option>
  63.         </select>
  64.     </p>
  65.   
  66.     <p>
  67.         <input type="checkbox" id="mwst" name="mwst" value="MWST" />
  68.         <label for="mwst">MWST</label>
  69.     </p>
  70.  
  71.     <p>
  72.         <input type="submit" value="Berechnen" />
  73.     </p>
  74.  
  75. </fieldset>
  76.     
  77.  
  78. </body>
  79. </html>
  80.  
File Description
  • E4_Grundstück
  • PHP Code
  • 25 Sep-2020
  • 1.76 Kb
You can Share it: