Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP Recordset Paging - Recordset Navigator Bar

Community Beginner ,
Nov 10, 2009 Nov 10, 2009

Hi There!

Look at this page:

http://martinique.org/martiniquenew/discovery/towns-villages.php

Use the Navigator bar to page through and you'll notice a very annoying thing - the page jumps to the top.

How can we prevent that to happen so we stay at the same level of the page when we navigate through the database?

Thank you much for your answers.

TOPICS
Server side applications
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 10, 2009 Nov 10, 2009

Using the recordset navigation bar reloads the page, so it naturally goes to the top. To get the page to reload at a particular place within the page, you need to add an ID to the element you want to navigate to, and add it at the end of the URL preceded by a hash sign.

The following example shows the ID mainDiv added to the end of the Next code from a recordset navigation bar:

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $

...
Translate
LEGEND ,
Nov 10, 2009 Nov 10, 2009

Using the recordset navigation bar reloads the page, so it naturally goes to the top. To get the page to reload at a particular place within the page, you need to add an ID to the element you want to navigate to, and add it at the end of the URL preceded by a hash sign.

The following example shows the ID mainDiv added to the end of the Next code from a recordset navigation bar:

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>#mainDiv">Next</a>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 10, 2009 Nov 10, 2009

Thank you very much David!

As usual you're right on target. (I made up this expression, I hope it make sense);-)

Just so you know, your books are THE Bible of web design/development for me.

I'm fortunate I met you through the books you wrote and I made so much progress since I got them.

I'm sure you have students coming from everywhere in the world.

Well, I'm one of your Senegalese student.

Thank you very much again!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 10, 2009 Nov 10, 2009
LATEST

Glad to have been of help. Thanks for your kind words about my books.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines