PHP學習者。下面的分頁腳本似乎一般工作,但問題是,在20個記錄的每個頁面上,當我選擇一些行(通過複選框)並單擊SUBMIT按鈕時,20個記錄的顯示跳回到第1頁。行是選擇沒有問題,但我不明白爲什麼它返回到第1頁。分頁腳本錯誤 - 爲什麼跳回第一頁?
是否在下面的腳本中顯而易見的問題?謝謝!
//-----------------|
// Add pagination.
//-----------------|
$nAdjacentPages = 3;
// If the current page number is greater than 1, then display:
// "<<" and "<" (i.e., << <).
if ($nCurrentPage > 1)
{
echo " <a href =
'{$_SERVER['PHP_SELF']}?nCurrentPage=1'> << </a> " ;
$nPreviousPage = $nCurrentPage - 1 ;
echo " <a href =
'{$_SERVER['PHP_SELF']}?nCurrentPage=$nPreviousPage'> < </a> ";
}
// Appearance of page links when viewing page 5:
// << < 2 3 4 [5] 6 7 8 > >>
for ($x = ($nCurrentPage - $nAdjacentPages) ;
$x < (($nCurrentPage + $nAdjacentPages) + 1) ;
$x++)
{
// if it's a valid page number...
if (($x > 0) and ($x <= $nTotalPages))
{
// If on current page, 'highlight' but do not link.
// If not current page, make it a link.
if ($x == $nCurrentPage)
{
echo " [<b> $x </b>] " ;
}
else
{
echo " <a href=
'{$_SERVER['PHP_SELF']}?nCurrentPage=$x'> $x </a> " ;
}
}
}
// If not last page, show '>' and '>>' links.
if ($nCurrentPage != $nTotalPages)
{
$nNextPage = $nCurrentPage + 1;
echo " <a href =
'{$_SERVER['PHP_SELF']}?nCurrentPage=$nNextPage'> > </a> ";
echo " <a href =
'{$_SERVER['PHP_SELF']}?nCurrentPage=$nTotalPages'> >> </a> ";
}
?>
你能發佈表單的HTML嗎?這將有助於確定它回到第1頁的原因。 –