0

I have three php pages:

  1. search.php which sets out a form with fields which are used to query a MYSQL database
  2. query.php which queries the database with variables set in search.php, and return a result array (which can be a large array), then redirect to result.php
  3. result.php , display the results in a table form. This page is not connected to the database, and this page is also bookmarkable, ie if someone bookmarks that page, it will display the result again without quering the database.

My problem is that I don't know how to make the result page bookmarkable.. I used session to carry the variable from query.php to result.php but once the browser is closed, the result page will display nothing.

If someone can help, it will be highly appreciated.

1
  • 2
    I suggest you to post your code so everybody can what you've done and what you should do to resolve your problem. It also avoid questions like: "Did you connect the database using xxx ?" etc ... Commented Jul 2, 2015 at 2:34

1 Answer 1

1

1. Bookmarks:
From what I know, browser bookmarks save the link to a page, so it would be wise to use $_GET[] variables with all the fields in the form so that every time some one visits the page, the server will know the search parameters automatically from the URL
Eg.

$search = $_GET["s"]
//Query database for parameter $search 

They would bookmark a link like this:
www.example.com/result.php?s=snoopy
Now the server would know "snoopy" is the search term.

2. Saving Data

"if someone bookmarks that page, it will display the result again without quering the database."

Unless you are planning to download the information, I don't think there is a way to load the data without querying the database again. But I bet there's some convoluted way to do it hidden somewhere in Browser Cookies or something like that... I don't think it's worth going that far though.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks David. However the result array can be too huge to append to the $_GET super variable. I have tried but it failed to convert everthing and append to the URL.
Can you please post your code? I'm quite lost on what you are trying to use arrays for.
sorry.. i think i misunderstood you earlier..i thought you were saying to append the result array the result.php page...i did exactly what you suggested..using $_GET[] for the search fields and pass them onto query page... but the problem is the result page....dont' know how to make it bookmarkable.... Will post my code when i get home later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.