Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Auti</title>
- </head>
- <body>
- <form action="index.php" method="post">
- <select name="odabir">
- <option value="bmw">bmw</option>
- <option value="audi">audi</option>
- </select>
- <input type="submit">
- </form>
- </body>
- </html>
- <?php
- echo $_POST['odabir'];
- $veza = new mysqli("localhost", "root", "1", "test");
- $upitString = "SELECT * FROM auti WHERE ime = ?";
- $upit = $veza->prepare($upitString);
- $upit->bind_param('s', $_POST['odabir']);
- $upit->execute();
- $query = $upit->get_result();
- if($query->num_rows > 0){
- print("<table border = 1>");
- echo "<tr> <td>Ime</td> <td>Ks</td> </tr>";
- while($redak = $query->fetch_assoc()){
- echo "<tr> <td>".$redak['ime']."</td> <td>".$redak['ks']."</td> </tr>";
- }
- print("</table>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement