1

Basically, I have a page where you search for a term, and the database is queried, those terms are spit out that contain the query and paginated like so:

1 2 [3] 4 5

MATTHEW 1:18
Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost.

MATTHEW 1:21
And she shall bring forth a son, and thou shalt call his name JESUS: for he shall save his people from their sins.

MATTHEW 1:25
And knew her not till she had brought forth her firstborn son: and he called his name JESUS.

This I have completed, the below I have not:

When I click on "Matthew", it should list all the verses and chapters in "Matthew" in a new page, paginated.

When I click back(in the browser), it should go back to the previous paginated result set(above), and when I click forward (in the browser), it should show me the page of all verses and stuff from the bible section I clicked on (Matthew).

I have absolutely no idea how to even start on any of this.

1
  • To answer your title question, you can store values in session variables if you want to use them in multiple scripts. Commented Nov 7, 2011 at 2:40

1 Answer 1

1

What you describe is the normal behavior of the browser when you make your requests RESTful. That simply means that you contain all the information necessary to display the correct page in the request itself. Since you're talking about simple links, that means you pass the required information in the URL itself:

http://example.com/verses.php?query=knew+her+not&page=3
http://example.com/verses.php?book=matthew

In your verses.php script you check for the existence of $_GET['query'] and/or $_GET['book'] and $_GET['page'] and retrieve and output information dynamically based in these variables. Then you just need to produce the appropriate links and the back/forward behavior is taken care of by the browser.

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

2 Comments

This didn't help at all. Do I have to include my database credentials in this file? I get no results when trying to query my database.
Please do realize that your question is extremely broad and generic. Sorry if I couldn't guess correctly where exactly your problem lies. Please ask more specific questions about more specific code in separate questions.

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.