I have a PHP site in two pages. The first page is the query screen - a regular HTML form with several fields (basically an address database). The second page displays the results of the query although if there are more than 15 records, it generates pagination links. The initial results on the second page works correctly.
After the initial results screen, when the user clicks on one of the other results pages, I want it to pass the variables posted from the original page in the query. Instead, when I use session variables, it takes the values from the last row generated on the second page. I tried registering the query as a session variable, but this doesn't seem to do anything.
How do I register the values for the variables from the initial query on the first page (which used the post method) as session variables for use on the second page (and without them being overwritten by the last record generated on the second page)?
Any help would be appreciated.
FROM PAGE 1
<FORM ACTION="search2.php" METHOD="POST">
...
<INPUT size=37 name="S_Address">
...
<SELECT NAME="S_City">
...
<SELECT NAME="S_Zip">
...
<INPUT TYPE="submit" VALUE="Find">
...
<FORM>
FROM PAGE 2
$query = "SELECT * FROM [database] WHERE S_Address like '$S_Address_String' and S_City like '$S_City' and S_Zip like '$S_Zip_String'";
...
echo("<a href=\"$PHP_SELF?Xpage=$z\">$z</a> \n");
[how pagination is displayed - $z is the page number. Based on its value, I use mysql_data_seek to move the recordset along to the next set of values]
...
$row = mysql_fetch_array ($result);
...
extract($row);
...
[results displayed at this point]
...
After the initial results screen, when the user clicks on one of the other results pages, I want it to pass the variables posted from the original page in the query. Instead, when I use session variables, it takes the values from the last row generated on the second page. I tried registering the query as a session variable, but this doesn't seem to do anything.
How do I register the values for the variables from the initial query on the first page (which used the post method) as session variables for use on the second page (and without them being overwritten by the last record generated on the second page)?
Any help would be appreciated.
FROM PAGE 1
<FORM ACTION="search2.php" METHOD="POST">
...
<INPUT size=37 name="S_Address">
...
<SELECT NAME="S_City">
...
<SELECT NAME="S_Zip">
...
<INPUT TYPE="submit" VALUE="Find">
...
<FORM>
FROM PAGE 2
$query = "SELECT * FROM [database] WHERE S_Address like '$S_Address_String' and S_City like '$S_City' and S_Zip like '$S_Zip_String'";
...
echo("<a href=\"$PHP_SELF?Xpage=$z\">$z</a> \n");
[how pagination is displayed - $z is the page number. Based on its value, I use mysql_data_seek to move the recordset along to the next set of values]
...
$row = mysql_fetch_array ($result);
...
extract($row);
...
[results displayed at this point]
...