Hi, here is the code for page navigation, its working fine but , if there are 4 pages , each page is displaying 3 records per page, if we go to 3rd page, and click on the subject it will display the contents but it will automatically come to the 1st page,,,,,,i dont want it to come to the first page. i want it to be remain in the same page where the user has clicked .......because i my code in half page i am showing records, if he click on some subject , in the second half of the page it is displaying contents as soon as he clicks.....so if he goes to 4th page and clicks on some subject it will show the contents but the first half portion of the page where i am displaying the records will automatically go to first page,,,,,,,,,,the second part will remain same......so help me out
here is the code..

<?
session_start();
include('database.php');
$page_name="contractor_inbox.php";
//$limit=sql_quote($_GET['limit']); // Read the limit value from query string.
$limit=$_GET['limit'];
//$start=sql_quote($_GET['start']); // To take care global variable if OFF
$start=$_GET['start'];
if(!($start > 0))
{ // This variable is set to zero for the first page
$start = 0;
}

$eu = ($start - 0); 
if(!$limit > 0 )
{ // if limit value is not available then let us use a default value
$limit = 4; // No of records to be shown per page by default.
} 
$this1 = $eu + $limit; 
$back = $eu - $limit; 
$next = $eu + $limit; 
//*****************************************************************/
$result = mysql_query("SELECT * FROM autoalto_mail where flag!='1'  limit $eu, $limit" ); 

//code for paging
//************************************************************************** 
$selcount = "SELECT * FROM autoalto_mail ORDER BY primarykey column name DESC" ;
$selcount =  "SELECT * FROM autoalto_mail where flag!='1'" ;
$result2=mysql_query($selcount);
$nume=mysql_num_rows($result2);
//echo $nume;
//session_register("nume");
//$nume = $_SESSION['nume'];
//session_register("nume");
$_SESSION['nume']=$nume;

//echo "<table>";
//**************************************************************************
while($row = mysql_fetch_array($result)) 
{?> 
<tr class="sectiontableentry2" ><!--<td width="5%"></td>-->
<td><? echo $row['From_user'];?></td> 
<td><a href="contractor_inbox.php?mail_id=<? echo $row['mail_id'];
//session_register("mail_id");
//session_register("mail_id");
?>">
<?echo $row['subject'];
$subj=$row['subject'];
session_register("subj");?> </a></td>
<td><?echo $row['date'];?></td>
</tr>
<!--<tr class="sectiontableentry1"></tr>

<!--<tr class="sectiontableentry1"><td width="5%"></td>
<td colspan="4" style="background-repeat: repeat-x;" background="images/dot.jpg" height="0" width="300"></td></tr>-->
<?
}?>
</table>
<?
if($nume > $limit)
{
//Counting no of pages and the current page.
$totnumofpages = round($nume/$limit);
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i == $eu)
{
$currentpage= $l;
}
$l=$l+1;
} 

echo "<div height=28 align=right><table cellpadding=3 cellspacing=1 border=0 height=28><tr><td>Page ".$currentpage." / ".$totnumofpages."</td>";
//// if our variable $back is equal to 0 or more then only we will display the link to move back //////// 
if($back >=0) 
{ 
print "<td align='left'><a href='$page_name?start=$back&limit=$limit'>&lt;</a></td>"; 
} 
//////////////// We will not display the current page as a link ///////////
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i <> $eu)
{
echo "<td align=center><a href='$page_name?start=$i&limit=$limit'><span>$l</span></a></td>";
}
else 
{ 
echo "<td align=center><span><b>$l</b></span></td>";
} /// Current page is not displayed as link 
$l=$l+1;
}
///////////// If we are not in the last page then Next link will be displayed. Here we check that /////
if($this1 < $nume) 
{ 
print "<td align=center width=15><a href='$page_name?start=$next&limit=$limit'><span ><b>&gt;</b></span></a></td>";
} 
echo "</tr></table></div>";
}
mysql_close();
?>

Hi,

Modify the following line.

<a href="contractor_inbox.php?mail_id=<? echo $row['mail_id'];//session_register("mail_id");//session_register("mail_id");?>">

with

><a href="contractor_inbox.php?start=$start&limit=$limit&mail_id=<? echo $row['mail_id'];
//session_register("mail_id");//session_register("mail_id");?>">

Ohh sorry, use this.

<a href="contractor_inbox.php?start=<?=$start?>&limit=<?=$limit?>&mail_id=<?=$row['mail_id'];?>">
This question has already been answered. Start a new discussion instead.