Facebook
From Corrupt Gorilla, 3 Years ago, written in PHP.
This paste is a reply to ref.inc.php from Mustard Pintail - view diff
Embed
Download Paste or View Raw
Hits: 75
  1. <?php
  2. $MarqueId = filter_input(INPUT_GET, 'MarqueId');
  3. include '../Pdo_start.inc.php';
  4. $pdo = pdo_connexion('natels');
  5. $sql_select = "SELECT `marque`.`idMarque`, `marque`.`nomMarque`
  6. FROM `marque`";
  7. $pdo_query = $pdo->query($sql_select);
  8. $tab_select = $pdo_query->fetchAll();
  9.  
  10. $picklist = "";
  11.  
  12. foreach ($tab_select as $row) {
  13.     $picklist .= "<option value='";
  14.     $picklist .= $row['idMarque'];
  15.     $picklist .= "'";
  16.     if ($MarqueId == $row['idMarque']) { $picklist .= " selected "; }
  17.        
  18.         $picklist .= ">".$row['nomMarque']."</option>";
  19.    
  20. }
  21. ?>
  22. <!DOCTYPE html>
  23. <!--
  24. To change this license header, choose License Headers in Project Properties.
  25. To change this template file, choose Tools | Templates
  26. and open the template in the editor.
  27. -->
  28. <html>
  29.     <head>
  30.         <meta charset="UTF-8">
  31.         <title></title>
  32.     </head>
  33.     <body>
  34.         <form>
  35.             <select name="MarqueId">
  36.                 <?= $picklist ?>
  37.             </select>
  38.             <input type="submit" value="Envoyer" />
  39.             <?= $MarqueId ?>
  40.         </form>
  41.     </body>
  42. </html>
  43.