Using session variables for searching

Using session variables for searching

by Nikki Macfarlane -
Number of replies: 0
I am wanting to add a search function to the book module so students can search a book for a particular word or phrase. I can get the search part working fine but at the moment the search picks up all occurrences of a phrase in every book.

I want the search to only look in the book the student is currently viewing. To do this I need to pick up the session variable for the book id which I can see is stored when I am looking at the book itself by looking at phpinfo(). I then have a link from one of the book chapters that goes to the first part of the search - the input form. At this point, the bookid session variable is lost.

What do I need to have at the beginning of the search file to make sure it carries over a session variable from a previous page?

Also, I would like to pick up the course id which I am assuming is stored wither as a session variable or as a cookie. Any ideas on how I pick this up as well and carry it across ot the search form?

Sorry if these seem pretty basic questions - I am a real novice in programming.

Nikki Macfarlane
Average of ratings: -