<div class="row-fluid"> <div class="span6"> <div class="span6"> <form method="POST" action="search.php" class="navbar-search pull-left"> <input type="text" name="search" class="search-query" placeholder="Search"> </form> </div> <br /> <br /> <br /> <table class="table table-bordered table-hover table-striped"> <thead> <tr> </tr> </thead> <tbody> <?php $query = mysql_query("select * from book") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { ?> <tr> <td><?php echo $row['title']; ?></td> <td><?php echo $row['author']; ?></td> <td><?php echo $row['category']; ?></td> </tr> <?php } ?> </tbody> </table> </div> </div>
<div class="span12"> <br /> <br /> <br /> <div class="row-fluid"> <div class="span6"> <div class="span6"> <form method="POST" class="navbar-search pull-left"> <input type="text" name="search" class="search-query" placeholder="Search"> </form> </div> <br /> <br /> <br /> <table class="table table-bordered table-hover table-striped"> <thead> <tr> </tr> </thead> <tbody> <?php if (isset($_POST['search'])) { $search = $_POST['search']; $query = mysql_query("select * from book where category like '%$search%' or title like '%$search%' or author like '%$search%'") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { ?> <tr> <td><?php echo $row['title']; ?></td> <td><?php echo $row['author']; ?></td> <td><?php echo $row['category']; ?></td> </tr> <?php } } ?> </tbody> </table> </div> </div> </div>