Advertisement
Guest User

Untitled

a guest
Oct 9th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.   <head>
  4.     <meta charset="utf-8">
  5.     <title>input-Elemente</title>
  6.     <style>
  7.      table,td{
  8.        border : 1pt solid black;
  9.      }
  10.     </style>
  11.   </head>
  12.   <body>
  13.     <form action ='shop.php' method = 'POST'>
  14.         <input type='text' name='suchfeld'><input type='submit' name='suche_enter' value='Suchen'>
  15.     </form>
  16.     <hr> <br>
  17.     <?php
  18.     if(isset($_POST['suche_enter']))
  19.     {
  20.       $host = "127.0.0.1";
  21.       $user = "root";
  22.       $pass = "";
  23.  
  24.       $mysqli = new mysqli($host,$user,$pass,"shop");
  25.  
  26.       $suchbegriff = $_POST['suchfeld'];
  27.       $result = $mysqli->query("SELECT PID,PName,PMarke FROM TProdukt WHERE PName LIKE '%$suchbegriff%'");
  28.  
  29.       echo '<table>';
  30.       echo '<tr><td>PID</td><td>PName</td><td>PMarke</td></tr>';
  31.       WHILE($ausgabe= $result->fetch_assoc())
  32.       {
  33.         echo'<tr>';
  34.         echo'<td>';
  35.         echo $ausgabe['PID'] ;
  36.         echo'</td>';
  37.         echo'<td>';
  38.         echo $ausgabe['PName'];
  39.         echo'</td>';
  40.         echo'<td>';
  41.         echo $ausgabe['PMarke'];
  42.         echo'</td>';
  43.         echo'<tr>';
  44.       }
  45.       echo'</table>';
  46.     }
  47.     ?>
  48.   </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement