• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing query results from view page to controller.

#1
[eluser]soyut[/eluser]
Hello,

I have built a search page. I enter some criteria and when i click the submit it runs a controller function then shows all the query results below(using "foreach").
However, I created an anchor link below the results table, and when you click that it runs the different function of the same controller. Problem is here. Somehow, I cant manage to put this query results of the search page to anchor link and pass it to the another function in the controller.

How can i pass this query results to another controller using anchor link?

Thanks in advance.

#2
[eluser]jprateragg[/eluser]
If you want to pass the query results of your search to the anchor function, you'll have to convert the results to a string, then pass the string to the anchor function.

Code:
$s = '';
foreach($data as $key => $value)
{
    //your code that formats/displays the search results
    $s .= 'a[]='. $value->field1 .'&b[]='. $value->field2 .'&c[]='. $value->field3;
}

This will convert your results into a string and allow you to pass the results to another page. However, it may be easier to create a private function that performs the search, pass the search parameters to your anchor function, then simply perform a new search on the new page using the private search function.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.