CodeIgniter Forums
Search Form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Search Form (/showthread.php?tid=41630)



Search Form - El Forum - 05-12-2011

[eluser]steviez[/eluser]
Hi,

I am trying to make a search for for my site that will allow my users to search for other members based on a few options.

For example there will be these options on the form:

- Name
- Profile Type
- Age
- Location

and possibly a few more. Now I know roughly how to get all these options passed to the script via post but how could I make it all paginate without the use of query strings?

Thanks


Search Form - El Forum - 05-12-2011

[eluser]Twisted1919[/eluser]
One way, maybe use uri segments like:
Code:
site.com/search/index/encode-username/encode-profile-type/integer-age/encoded-location

<?php
$name=$this->uri->segment(3);
$profile_type=$this->uri->segment(4);
$age=$this->uri->segment(5);
$location=$this->uri->segment(6);
?>
Be careful at the restriction characters of the uri segments(maybe base64_encode() ? )

Another way, is session, save the search params in session and use them when paginate.

Another way, through database, you create a special table for the search, and store a unique hash in it and the search params. Smth like :
Code:
url : site.com/search/index/md5($string)/page/4

<?php
$hash=$this->uri->segment(3);
//query the database using $hash to get the search params, then use the search params to get the search results.
?>

You see, we have solutions Wink