Skip to main content
ElizabethGailLittle
Inspiring
December 4, 2020
Answered

In multi-page display, how to return to same page?

  • December 4, 2020
  • 3 replies
  • 621 views

I have a display page which shows 6 records at a time with First/Prev/Next/Last available as appropriate.  When I navigate away from the page to add a new record, delete a record, or edit a record, I come back to the first page.  Is there a way to return to the same page?  I have tried using session variables without success.  Is there a way to send TWO variables to the next page?  ie Show.php?var1=$var1&&var2=$var2?  Thanks for any advice!

This topic has been closed for replies.
Correct answer osgood_

Well you can certainly send 2 variables in the link:

 

<a href="show.php?variable_1=Something&variable_2=Somethingelse">Show</a>

 

Have a look at the php script which generates the pagination for First/Prev/Next/Last and more so have a look at the source code in your browser, which is generated from the script. It might reveal information about how the links are working out which page of database results to display. If you can determined that then all you should need to do is send the php variable, which shows the correct page of results to display, to your editing page via the editing link then you can redirect back to your master page, which shows the database results, using a php location redirect, after you have finished the editing process.

 

And yes this is not a good idea for adding and deleting but  editing should work as the information should remain 'static'.

 

 

3 replies

ElizabethGailLittle
Inspiring
December 9, 2020

I need to clarify because I think I'm using the word "page" in 2 senses.  I have a page that shows 6 records at a time from a table.  There is navigation First/Prev/Next/Last.  There is also the option to ADD a new record, edit one of the records, or delete one of the records.  In each of the 3 latter situations, I call a different php page and then return to the display page.  In the case of add and delete, I might put up with returning to the FIRST 6 records in the table, but I'd prefer, particularly after editing a record, to return to the same set of records on display when I left.  I've tried setting a record set #, the previous next record #, and the previous previous record # in a session variable, but so far it's not working.  I hope this makes sense!  If it's possible to send TWO variables in the hyperlink that would help a lot, but I haven't figured that out...

osgood_Correct answer
Legend
December 10, 2020

Well you can certainly send 2 variables in the link:

 

<a href="show.php?variable_1=Something&variable_2=Somethingelse">Show</a>

 

Have a look at the php script which generates the pagination for First/Prev/Next/Last and more so have a look at the source code in your browser, which is generated from the script. It might reveal information about how the links are working out which page of database results to display. If you can determined that then all you should need to do is send the php variable, which shows the correct page of results to display, to your editing page via the editing link then you can redirect back to your master page, which shows the database results, using a php location redirect, after you have finished the editing process.

 

And yes this is not a good idea for adding and deleting but  editing should work as the information should remain 'static'.

 

 

ElizabethGailLittle
Inspiring
December 12, 2020

Thanks!  I will try all that you suggested.

Legend
December 7, 2020

I don't know how you have your 'First/Prev/Next/Last' navigation set up BUT when you click on any of those options they must be sending information to the pagination php script on your page which gets and delivers the correct page to view.

 

If you can identify the php variable being populated or created by the 'First/Prev/Next/Last' options when clicked then you can pass it between pages using a url parameter and after you have finished your editing you can use that parameter in a url string to go back to the original page and query the script which will get the correct page to view based on what is being passed to it in the url parameter.

BenPleysier
Community Expert
Community Expert
December 5, 2020

Not knowing the exact conditions that ypu have created, this may be of use: https://www.w3schools.com/jsref/met_his_back.asp

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!