Monday 16 January 2017

Sample Code To Search In PHP

Sample Code To Search.



<html>
<head>
<title>
Search your favorite book
</title>


<style>

marquee{
background:8f8f8f;
color:white;
}



body{
background:#f0f0f0;
margin:0px;
}

table{
width:100%;
background:#8080ff;
height:80%;
margin:0px;
}
.new{
background:#ffffff;
}


</style>



</head>





<body >

<h2><marquee > <img src="images/loadingCircle.gif"/>  Karakoram International University Library Management System  <img src="images/loading.gif"/></h2>
</marquee>
<div id="col_right">
<p align="center">
Welcome to book search page<div align="right"><a href="index.php" ><img src="images/bof_00.jpg"></a></div>
</p>

<table>
 <tr>
 <td>
 <img src="images/mono.gif" width="200" height="175"  /> </br>

</td>
<td align="center">
<p class="new"><b>KIU-LMS</b></p>
<form action="" method="post">
<input type="text" name="bookName" size="40"><br/><br/>
<input <input type="submit" name="submit" value="Search the book"><hr/>

</form>

</td>

<td>
<div align="right"> <img src="images/about.jpg" width="200" height="175" /> </div></br>


</td>
</tr>
<tr>
<td>
 <img src="images/22.jpg" width="200" height="175" /> </br>


</td>
<td align="center">


<?php


include("settings.php");
if(isset($_POST['submit']))
{
$book=$_POST['bookName'];
$result=mysql_query("SELECT* FROM books WHERE bookName='$book' ");
if(count($result)==0)
echo"book not found";

else
{
echo"<table><tr><th>Book id</th>  <th>Book name</th>  <th>Writer</th> <th>Publisher</th> <th>Price</th>  </tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr>";
echo"<td>".$row['id'] ."</td>";
echo"<td>".$row['bookName'] ."</td>";
echo"<td>".$row['writer'] ."</td>";
echo"<td>".$row['publisher'] ."</td>";
echo"<td>".$row['price'] ."</td>";
echo"</tr>";
echo"<br/>";
}
}
}
echo"</table>";

?>

</td>
<td>
<div align="right"> <img src="images/mono.gif" width="200" height="175" /> </div></br>


</td>
</tr>

</table>
</body>
</html>
Previous Post
Next Post

0 comments: