Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $page_title = 'Search All Items';
- include('include\header.html');
- $tag = isset($_REQUEST['tag']) ? $_REQUEST['tag'] : '';
- ?>
- <!DOCTYPE html>
- <body>
- <center><h3>Search For Items</h3></center>
- <center><form method="post" action="search.php?go" id="searchform">
- <select name="tag">
- <option value="isbn">ISBN</option>
- <option value="item">Item</option>
- <option value="company">Company</option>
- <option value="year">Year</option>
- </select>
- <input type="text" name="search">
- <input type="submit" name="submit" value="Search">
- </form></center>
- <?php
- if(isset($_POST['submit']))
- {
- if(isset($_GET['go']))
- {
- if(preg_match("/^[a-zA-Z0-9]+$/", $_POST['search']))
- {
- $search = $_POST['search'];
- echo "<center><p>Your Search is: $search</p></center>";
- include('include\db_connect.php');
- $db_link = db_connect('blackmarket');
- if($tag == "isbn")
- {
- $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE isbn LIKE '%" . $search . "%'";
- $result = mysql_query($query);
- while($row = mysql_fetch_array($result))
- {
- $isbn_b00059209 = $row['isbn'];
- echo "<center><table border='1' cellpadding = '10'>";
- echo "<tr>";
- echo "<td>ISBN: " . $isbn_b00059209 . "</td>";
- echo "<td><a href='detailItem.php?isbn=" . $isbn_b00059209 . "'><img src = 'images/" . $row['image']. "'></a></td>";
- echo "<td>COMPANY: " . $row['company']. "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>ITEM: " . $row['item']. " </td>";
- echo "<td>PRICE: " . $row['price']. " </td>";
- echo "<td>YEAR: " . $row['year'] . "</td>";
- echo "</table></center>";
- echo "<br>";
- }
- }
- if($tag == "item")
- {
- $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE item LIKE '%" . $search . "%'";
- $result = mysql_query($query);
- while($row = mysql_fetch_array($result))
- {
- $item_b00059209 = $row['item'];
- echo "<center><table border='1' cellpadding = '10'>";
- echo "<tr>";
- echo "<td>ISBN: " . $row['isbn']. "</td>";
- echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
- echo "<td>COMPANY: " . $row['company']. "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>ITEM: " . $item_b00059209 . " </td>";
- echo "<td>PRICE: " . $row['price']. " </td>";
- echo "<td>YEAR: " . $row['year'] . "</td>";
- echo "</table></center>";
- echo "<br>";
- }
- }
- if($tag == "company")
- {
- $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE company LIKE '%" . $search . "%'";
- $result = mysql_query($query);
- while($row = mysql_fetch_array($result))
- {
- $company_b00059209 = $row['company'];
- echo "<center><table border='1' cellpadding = '10'>";
- echo "<tr>";
- echo "<td>ISBN: " . $row['isbn'] . "</td>";
- echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
- echo "<td>COMPANY: " . $company_b00059209. "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>ITEM: " . $row['item']. " </td>";
- echo "<td>PRICE: " . $row['price']. " </td>";
- echo "<td>YEAR: " . $row['year'] . "</td>";
- echo "</table></center>";
- echo "<br>";
- }
- }
- if($tag == "year")
- {
- $query = "SELECT isbn,image,item,price,company,year FROM itemstore WHERE year LIKE '%" . $search . "%'";
- $result = mysql_query($query);
- while($row = mysql_fetch_array($result))
- {
- $year_b00059209 = $row['year'];
- echo "<center><table border='1' cellpadding = '10'>";
- echo "<tr>";
- echo "<td>ISBN: " . $row['isbn'] . "</td>";
- echo "<td><a href='detailItem.php?isbn=" . $row['isbn'] . "'><img src = 'images/" . $row['image']. "'></a></td>";
- echo "<td>COMPANY: " . $row['company'] . "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>ITEM: " . $row['item']. " </td>";
- echo "<td>PRICE: " . $row['price']. " </td>";
- echo "<td>YEAR: " . $year_b00059209 . "</td>";
- echo "</table></center>";
- echo "<br>";
- }
- }
- }
- else
- {
- echo "<center><p>Please enter a search query</p></center>";
- }
- }
- }
- ?>
- </body>
- </html>
- <?php
- include('include\footer.html');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement