I really gate asking this question again.....but I am really stuck. Here goes.
I have two scripts.
1) newsearch.php - This is a simple search form that passes variables to the next script.
2) newcode.php - This is my "main script". This script takes the variables from my search form, querys the database, and displays the results with pagination.
These two scripts work fine and I have sessions in place like this:
****** session in newsearch.php *******
<?
session_start();
session_unset();
session_register("selecttown");
?>
selecttown is the name of one of the variables. Notice, that I have unset listed here. This is because without it....if someone tried a second search....the results of the first search were displayed. I am using unset to clear the session if someone goes to the searchform a second time.
****** session in newcode.php *******
session_start();
So, the scripts are working together....in this scenerio...
1) user performs a search
2) gets results
3) needs another search so they go back to newsearch.php page.
4) performs another search
5) get results of second search....
I want to avoid step 3. I want to include a searchform with newcode.php so the results are displayed and they have the option of trying a different search right from the results page.
At first, I figured I would just include the newsearch.php script in newcode.php.
This will not work because of this scenerio...
1) user performs a search
2) gets results
3) Goes to second page with pagination
4) Gets error no match to query.....because of the unset in the included file.
So, I have a feeling that I am not using sessions correctly....or I shouldnt be using unset the way I am using it. Can someone please offer me a solution. It shouldnt be too difficult....all I want is to:
1) Allow pagination to work
2) Give users the ability to perform a new search right from results page.
I apprecate all the help you can give....
What about including a third script.....a different searchform....how would sessions be used in that case?