Advertisement
adamtimtim

Untitled

Apr 26th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. <?php
  2. $page_title = 'Search All Items';
  3. include('include\header.html');
  4. $tag = isset($_REQUEST['tag']) ? $_REQUEST['tag'] : '';
  5. ?>
  6.  
  7. <!DOCTYPE html>
  8. <body>
  9. <center><h3>Search For Items</h3></center>
  10. <center><form method="post" action="search.php?go" id="searchform">
  11. <select name="tag">
  12. <option value="isbn">ISBN</option>
  13. <option value="item">Item</option>
  14. <option value="company">Company</option>
  15. <option value="year">Year</option>
  16. </select>
  17. <input type="text" name="search">
  18. <input type="submit" name="submit" value="Search">
  19. </form></center>
  20. <?php
  21. if(isset($_POST['submit']))
  22. {
  23. if(isset($_GET['go']))
  24. {
  25. if(preg_match("/^[a-zA-Z0-9]+$/", $_POST['search']))
  26. {
  27. $search = $_POST['search'];
  28.  
  29. echo "<center><p>Your Search is: $search</p></center>";
  30.  
  31. include('include\db_connect.php');
  32. $db_link = db_connect('blackmarket');
  33.  
  34. if($tag == "isbn")
  35. {
  36. $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE isbn LIKE '%" . $search . "%'";
  37. $result = mysql_query($query);
  38. while($row = mysql_fetch_array($result))
  39. {
  40. $isbn_b00059209 = $row['isbn'];
  41.  
  42. echo "<center><table border='1' cellpadding = '10'>";
  43. echo "<tr>";
  44. echo "<td>ISBN: " . $isbn_b00059209 . "</td>";
  45. echo "<td><a href='detailItem.php?isbn=" . $isbn_b00059209 . "'><img src = 'images/" . $row['image']. "'></a></td>";
  46. echo "<td>COMPANY: " . $row['company']. "</td>";
  47. echo "</tr>";
  48. echo "<tr>";
  49. echo "<td>ITEM: " . $row['item']. " </td>";
  50. echo "<td>PRICE: " . $row['price']. " </td>";
  51. echo "<td>YEAR: " . $row['year'] . "</td>";
  52. echo "</table></center>";
  53. echo "<br>";
  54. }
  55. }
  56.  
  57. if($tag == "item")
  58. {
  59. $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE item LIKE '%" . $search . "%'";
  60. $result = mysql_query($query);
  61. while($row = mysql_fetch_array($result))
  62. {
  63. $item_b00059209 = $row['item'];
  64.  
  65. echo "<center><table border='1' cellpadding = '10'>";
  66. echo "<tr>";
  67. echo "<td>ISBN: " . $row['isbn']. "</td>";
  68. echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
  69. echo "<td>COMPANY: " . $row['company']. "</td>";
  70. echo "</tr>";
  71. echo "<tr>";
  72. echo "<td>ITEM: " . $item_b00059209 . " </td>";
  73. echo "<td>PRICE: " . $row['price']. " </td>";
  74. echo "<td>YEAR: " . $row['year'] . "</td>";
  75. echo "</table></center>";
  76. echo "<br>";
  77. }
  78. }
  79.  
  80. if($tag == "company")
  81. {
  82. $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE company LIKE '%" . $search . "%'";
  83. $result = mysql_query($query);
  84. while($row = mysql_fetch_array($result))
  85. {
  86. $company_b00059209 = $row['company'];
  87.  
  88. echo "<center><table border='1' cellpadding = '10'>";
  89. echo "<tr>";
  90. echo "<td>ISBN: " . $row['isbn'] . "</td>";
  91. echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
  92. echo "<td>COMPANY: " . $company_b00059209. "</td>";
  93. echo "</tr>";
  94. echo "<tr>";
  95. echo "<td>ITEM: " . $row['item']. " </td>";
  96. echo "<td>PRICE: " . $row['price']. " </td>";
  97. echo "<td>YEAR: " . $row['year'] . "</td>";
  98. echo "</table></center>";
  99. echo "<br>";
  100. }
  101. }
  102.  
  103. if($tag == "year")
  104. {
  105. $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE year LIKE '%" . $search . "%'";
  106. $result = mysql_query($query);
  107. while($row = mysql_fetch_array($result))
  108. {
  109. $year_b00059209 = $row['year'];
  110.  
  111. echo "<center><table border='1' cellpadding = '10'>";
  112. echo "<tr>";
  113. echo "<td>ISBN: " . $row['isbn'] . "</td>";
  114. echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
  115. echo "<td>COMPANY: " . $row['company'] . "</td>";
  116. echo "</tr>";
  117. echo "<tr>";
  118. echo "<td>ITEM: " . $row['item']. " </td>";
  119. echo "<td>PRICE: " . $row['price']. " </td>";
  120. echo "<td>YEAR: " . $year_b00059209 . "</td>";
  121. echo "</table></center>";
  122. echo "<br>";
  123. }
  124. }
  125.  
  126.  
  127. }
  128. else
  129. {
  130. echo "<center><p>Please enter a search query</p></center>";
  131. }
  132. }
  133. }
  134. ?>
  135.  
  136. </body>
  137. </html>
  138.  
  139. <?php
  140. include('include\footer.html');
  141. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement