SHARE
TWEET

bura

a guest Jan 20th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Auti</title>
  5. </head>
  6. <body>
  7.  
  8.     <form action="index.php" method="post">
  9.         <select name="odabir">
  10.           <option value="bmw">bmw</option>
  11.           <option value="audi">audi</option>
  12.         </select>
  13.         <input type="submit">
  14.     </form>
  15. </body>
  16. </html>
  17.  
  18. <?php
  19.     echo $_POST['odabir'];
  20.  
  21.     $veza = new mysqli("localhost", "root", "1", "test");
  22.  
  23.     $upitString = "SELECT * FROM auti WHERE ime = ?";
  24.     $upit = $veza->prepare($upitString);
  25.     $upit->bind_param('s', $_POST['odabir']);
  26.     $upit->execute();
  27.     $query = $upit->get_result();
  28.  
  29.     if($query->num_rows > 0){
  30.         print("<table border = 1>");
  31.         echo "<tr> <td>Ime</td> <td>Ks</td> </tr>";
  32.        
  33.         while($redak = $query->fetch_assoc()){
  34.             echo "<tr> <td>".$redak['ime']."</td> <td>".$redak['ks']."</td> </tr>";
  35.         }
  36.  
  37.         print("</table>");
  38.     }
  39. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top