LePetitGlacon

PHP FICHE 3 Cinema

Feb 3rd, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.21 KB | None | 0 0
  1. <?php
  2. if(isset($_REQUEST["reponse"])) {
  3.  
  4.  
  5.  
  6.     if ($_REQUEST["tarifs"] == "tarifPlein")
  7.     {
  8.         $prixTotal = 8.70;
  9.     }
  10.     else
  11.     {
  12.         if ($_REQUEST["tarifs"] == "tarifEtudiant")
  13.         {
  14.          $prixTotal = 5.90;
  15.         }
  16.         else
  17.         {
  18.             if ($_REQUEST["tarifs"] == "tarifReduit")
  19.             {
  20.                 $prixTotal = 6.90;
  21.             }
  22.             else
  23.             {
  24.                 $prixTotal = 5.20;
  25.             }
  26.         }
  27.     }
  28.  
  29.     if ($_REQUEST["heures"] == "11:10" || $_REQUEST["jours"] == "lundi")
  30.     {
  31.         $prixTotal = 5.20;
  32.     }
  33.  
  34.     if (isset($_REQUEST["cbMajoration"]) && $_REQUEST["cbMajoration"] == "check")
  35.     {
  36.         $prixTotal = $prixTotal + 1.5;
  37.     }
  38.     else
  39.     {
  40.  
  41.     }
  42.    
  43.     if (isset($_REQUEST["cbReduction"]) && $_REQUEST["cbReduction"] == "check")
  44.     {
  45.         $prixTotal = $prixTotal - 1;
  46.     }
  47.     else
  48.     {
  49.        
  50.     }
  51. }
  52. ?>
  53. <!DOCTYPE html>
  54.  
  55. <html>
  56. <body class="container">
  57. <h1>Cinéma</h1>
  58. <form method="post">
  59.  
  60.     <p>Quel jour ?</p>
  61.     <select name="jours">
  62.         <option name="jours" value="choisir">Choisir un jour</option>
  63.         <option name="jours" value="lundi">Lundi</option>
  64.         <option name="jours" value="mardi">mardi</option>
  65.         <option name="jours" value="mercredi">mercredi</option>
  66.         <option name="jours" value="jeudi">jeudi</option>
  67.         <option name="jours" value="vendredi">vendredi</option>
  68.         <option name="jours" value="samedi">samedi</option>
  69.         <option name="jours" value="dimanche">dimanche</option>
  70.     </select>
  71.     <br><br>
  72.     <p>Quelle heure ?</p>
  73.     <select name="heures">
  74.         <option name="heures" value="choisir">Choisir un horraire</option>
  75.         <option name="heures" value="11:10">11:10</option>
  76.         <option name="heures" value="12">12:00</option>
  77.         <option name="heures" value="14">14:00</option>
  78.         <option name="heures" value="16">16:00</option>
  79.         <option name="heures" value="18">18:00</option>
  80.         <option name="heures" value="20">20:00</option>
  81.         <option name="heures" value="22">22:00</option>
  82.     </select>
  83.     <br><br>
  84.  
  85.  
  86.     <p>Quel tarif ?</p>
  87.     <input type="radio" name="tarifs" value="tarifPlein">Plein tarif :  8,70€<br>
  88.     <input type="radio" name="tarifs" value="tarifEtudiant">Tarif étudiant :  5,90€<br>
  89.     <input type="radio" name="tarifs" value="tarifReduit">Tarif réduit :  6,90€<br>
  90.     <input type="radio" name="tarifs" value="tarifSpecial">Tarif spécial :  5,20€<br><br>
  91.  
  92.     <input type="checkbox" name="cbMajoration" value="check"> Film 3D :  1,50€<br>
  93.     <input type="checkbox" name="cbReduction" value="check"> Réduction :  1€<br><br>
  94.  
  95.     <input type="submit" name="reponse" value="Valider">
  96. </form>
  97.  
  98. <?php
  99. if(isset($_REQUEST["reponse"]))
  100. {
  101.     ?>
  102.     <hr>
  103.     <p>Votre place de cinema coûte <?php echo $prixTotal ?>0 €</p>
  104.     <?php
  105. }
  106. ?>
  107.  
  108. </body>
  109. <head>
  110.     <title></title>
  111.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
  112. </head>
  113. </html>
Advertisement
Add Comment
Please, Sign In to add comment