Advertisement
Guest User

form

a guest
Feb 25th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.55 KB | None | 0 0
  1.  <form method="GET" class="form-inline align-self" style="margin-left:2%; margin-top:15px;">
  2.            <div class="input-group mb-2 mr-sm-2 mb-sm-0">
  3.              <div class="input-group-addon">Where?</div>
  4.              <select class="custom-select mb-2 mr-sm-2 mb-sm-0 form-control" name="choice">
  5.  
  6.                <option selected> <?php echo(isset ($_GET["choice"]))?$_GET["choice"]:"Choix..";?></option>
  7.                  <option value="PROJECT">Projet</option>
  8.                  <option value="ACCOUNT">Utilisateur</option>
  9.              </select>
  10.            </div>
  11.  
  12.            <button type="submit" class="btn btn-primary">Valider</button>
  13.  
  14.            <?php
  15.            if (isset( $_GET['choice'] )) {
  16.              ?>
  17.               <div class="input-group mb-2 mr-sm-2 mb-sm-0">
  18.                 <div class="input-group-addon">Table?</div>
  19.                 <select class="custom-select mb-2 mr-sm-2 mb-sm-0 form-control" name="table">
  20.                   <option selected>Choix..</option>
  21.                     <?php
  22.                      $req = getDB()->prepare('SELECT * FROM '.$_GET['choice'].';');
  23.                       $req -> execute();
  24.                       $row = $req->fetch(PDO::FETCH_ASSOC);
  25.                       foreach ($row as $key => $value) {
  26.                         echo '<option>'.$key.'</option>';
  27.                       }
  28.                       $req->closeCursor();
  29.                      ?>
  30.                 </select>
  31.               </div>
  32.               <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" name="search" placeholder="mot clef de recherche">
  33.               <button type="submit" class="btn btn-primary">Rechercher</button>
  34.               <?php
  35.              if (isset( $_GET['table'] )) {
  36.                ?>
  37.                 <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
  38.                 <table class="table table-bordered table-hover">
  39.                    <thead>
  40.                      <tr>
  41.                        <?php
  42.                       $req = getDB()->prepare('SELECT * FROM '.$_GET['choice'].' WHERE '.$_GET['table'].' = '.$_GET['search'].';');
  43.                        $req -> execute();
  44.                        $row = $req->fetch(PDO::FETCH_ASSOC);
  45.                        foreach ($row as $key => $value) {
  46.                          echo '<th>'.$key.'</th>';
  47.                        }
  48.                        echo "</tr>
  49.                      </thead>
  50.                      <tbody>";
  51.                        $req -> execute();
  52.                        while ($row = $req->fetch(PDO::FETCH_ASSOC)) {
  53.                          echo '<tr>';
  54.                            foreach ($row as $key => $value) {
  55.                              echo '<td>'.$value.'</td>';
  56.                            }
  57.                          echo '</tr>';
  58.                        }
  59.                        $req->closeCursor();
  60.                       ?>
  61.  
  62.                    </tbody>
  63.                  </table>
  64.                 <?php
  65.              }
  66.              else {
  67.                echo'
  68.                <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
  69.                   <h5 style="text-align:center"> Il manque des paramètres </h5>
  70.                 ';
  71.               }
  72.             }
  73.             else {
  74.               echo'
  75.               <div class="zone container" style="margin-left:2%;margin-bottom:2%;width: 96%;overflow: scroll;height: 500px">
  76.               ';
  77.             }
  78.             ?>
  79.  
  80.  
  81.          </div>
  82.        </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement