Hi every one!
I have been developing PHP applications from last one year, all the time I have been using Hidden fields and Query strings to pass my variable within the same page or to a different page.
Current Situation:
Right now I have a search page "searchMembers.php" I am making an SQL query based upon the user choice. Depending upon the number of rows returned in the search result I am printing links to the other RESULT PAGES (1 | 2 | 3 | NEXT). To access the SQL query I have made based upon the user choice, I am sending my query with the URL to all other result pages by doing the following php work
PHP Code:
// seralize sql query
$serial_var = serialize($searchQuery);
//encode sql query
$out_var = rawurlencode($serial_var);
// save encoded query to a variable
$searchquery = $out_var;
// then attach this sql query to the URLs to other pages in following way
// a for loop to print links to number of pages of i.e. 1 | 2 | Next
for ($i = 0; $i < $pages; $i++)
{
$url = "$ME?screen=" . $i ;
// here I am attaching my encoded query to Query String
$myhtml .="<FONT =\"#000000\"> | <a href=\"$url&searchfor=$searchfor&searchquery=$searchquery\">". ($i+1)."</a> |</FONT>\n";
}
MY PROBLEM:
so for I have been able to attach query to the query string but when I can not get my full query when I get the variable saved in the query string, just to clarify the situation I am using decode and unseralize method when I am retreing my variable in the following way
PHP Code:
$myQuery = unserialize(rawurldecode($_GET["searchquery"]));
$qid = new PGM_Sql();
$qid->query($myQuery);
$resultNumOfRows = $qid->num_rows();
SO ANY ONE PLEASE SUGGEST ME THE BEST WAY TO PASS THIS QUERY TO THE SAME PAGE, I AM SURE THIS ONE WOULD BE SIMPLE FOR MANY OF YOU BUT I CANT FIND THE WAY OUT OF IT.