<html>
<body>
<div id="content">
  <style>
.current {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #000099;
font-weight: bold;
background-color: #000099;
color: #FFF;
}
li {
display:inline-block
}
</style>
  <?php
include"connection.php";
$start=0;
$limit=5;
$page='';
if(isset($_POST['fullname'])){
$term=$_POST['fullname'];}
if(isset($_GET['page'])){
$page=$_GET['page'];
$start=($page-1)*$limit;
}
{
if(isset($_POST['Submit'])){
$query=mysql_query
("select * from users  where FirstName like '%$_REQUEST[fullname]%' LIMIT $start, $limit");
$search_num_rows = mysql_num_rows($query);
echo"<div>Found " .$search_num_rows. " results for " .$term. "</div>";
}
else{
$query=mysql_query("select * from users LIMIT $start, $limit");
}
echo "<table border='1'>
<tr class='tableheader'>
<th>First Name</th>
<th>Last name</th>
<th>User Id</th>
<th>User Name</th>
<th>Password</th>
<th>Email</th>
<th>Created Date</th>
<th>Gender</th>
</tr>";
while($row=mysql_fetch_array($query)){
echo "<tr class='tablerow'>";
echo "<td>" . $row['FirstName']      ."</td>";
echo "<td>" . $row['LastName']       ."</td>";
echo "<td>" . $row['UserID']     ."</td>";
echo "<td>" . $row['UserName']       ."</td>";
echo "<td>" . $row['Password']       ."</td>";
echo "<td>" . $row['Email']          ."</td>";
echo "<td>" . $row['CreatedDate']    ."</td>";
echo "<td>" . $row['Gender']     ."</td>";
echo "</tr>";    
}
echo "</table></div>";
$rows=mysql_num_rows(mysql_query("select * from users"));
$total=ceil($rows/$limit);
echo "<ul class='page'>";
for($i=1;$i<=$total;$i++){
if($i==$page) {
echo "<li class='current'>".$i."</li>"; }
else {
echo "<li><a href='?page=".$i."'>".$i."</a></li>"; }
}
echo "</ul>";
if(isset($_POST['insert'])){
$Number     =$_POST['pagination'];
$Number=urlencode($Number);
header ("Location:http://localhost:1234/city/search.php?page=$Number"); 
if ($Number >= $i || '0'){
header ("Location:http://localhost:1234/city/search.php?page=1"); 
exit;
}}}

?>
  <form method="post" id="frm" name="frm" action='search.php'>
    <table width="500" border="0">
      <tr>
        <th>Search here:</th>
        <td><input type="text"  name="fullname" id="fullname" size="50"/></td>
        </tr>
        <tr>     
        <td><input type="submit" name="Submit" value="Search" /></td>
        <td> </td>
      </tr>
  </form>
  <form style="width:50%"  method="post" id="123" name="1234" action="" >
  <tr>
        <th>Go To Page:</th>
    <td><input type="text" value=""  name="pagination" class="" size="50"/></td>
    </tr>
    <tr>
    <td><input name="insert" type="submit" class="button" value="go" /></td>
     </table>
  </form>
</div>
</body>
</html>

how do i search on current pagination
this code search all data not from current pagination page
please help me out as soon as posible

Recommended Answers

All 2 Replies

Member Avatar for diafol

This issue has an ongoing thread here:

http://www.daniweb.com/web-development/php/threads/481501/want-to-search-on-current-pagination-number

The fact that you've posted a new thread suggests that you are not content with replies gained so far and are not prepared to wait for the next reply. This is a slap in the face for those who have attempted to help you and they couldn't be blamed for putting you on their "one to ignore list". Consider yourself ignored.

not understand you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.