Advertisement
Guest User

Untitled

a guest
Jul 10th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <form action="Display.php" method="post">
  2. <select name="searchValue">
  3. <option value="<?php $allColomns ?>">All</option>
  4. <option value="itemCode">Item Code</option>
  5. <option value="shopNumber">Shop Code</option>
  6. </select>
  7. <input type="text" name="search">
  8. <input type="submit">
  9. </form>
  10.  
  11. $search = "%" . $_POST["search"] . "%";
  12. $searchValue = $_POST["searchValue"];
  13. //create the query
  14. $result = mysql_query("SELECT shopCode, itemNumber, itemDescription FROM sbh_itemsheet WHERE '$searchValue' LIKE '$search'");
  15.  
  16. //return the array and loop through each row
  17. while ($row = mysql_fetch_array($result))
  18. {
  19. ?>
  20. <tr>
  21. <td><?php echo $row['id'];?></td>
  22. <td><?php echo $row['shopCode'];?></td>
  23. <td><?php echo $row['itemNumber'];?></td>
  24. <td><?php echo $row['itemDescription'];?></td>
  25. </tr>
  26.  
  27. $allColomns
  28.  
  29. $allcolomns = "shopCode, itemNumber, itemDescription";
  30.  
  31. $result = mysql_query("select * from sbh_itemsheet WHERE <column_name> LIKE '%".$_POST[search]."%'");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement