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

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

Participant ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

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!

TOPICS
Code , How to , Server side applications

Views

331

Translate

Translate

Report

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 , Dec 09, 2020 Dec 09, 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,

...

Votes

Translate

Translate
Community Expert ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

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

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

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 ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Participant ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

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...

Votes

Translate

Translate

Report

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 ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

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'.

 

 

Votes

Translate

Translate

Report

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
Participant ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

Thanks!  I will try all that you suggested.

Votes

Translate

Translate

Report

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
Participant ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

I tried sending two parameters, but when I do, I get 

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

 

I have no idea where the %20 came from, but my second parameter didn't get there.

Votes

Translate

Translate

Report

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
Participant ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

Same happens when I use 

Header("Location: Routine2.php?var1=$var1&var2=$var2");

Votes

Translate

Translate

Report

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
Participant ,
Dec 12, 2020 Dec 12, 2020

Copy link to clipboard

Copied

Kept at it and finally was successful.  Typos!!!!!!  I appreciate your help in solving my problem.  THANKS!

Votes

Translate

Translate

Report

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 ,
Dec 13, 2020 Dec 13, 2020

Copy link to clipboard

Copied

LATEST

Kept at it and finally was successful.

 

Good job, well done. Truth be known that's what we all do. The secret is building up enough knowledge to be able to logically work out if a process seems possible, then a little trial and error, while trying to avoid the one or two typo errors.

Votes

Translate

Translate

Report

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