Welcome Guest, Not a member yet? Register   Sign In
Search function: How to get form field values as CI URI parameters?
#21

[eluser]pickupman[/eluser]
You have the same abilities, but you need to look at the search term as part of the uri path rather than a GET parameter.

Example:
http://www.mysite.com/search.php?s=form+handler

Using the inflector helper:
http://www.mysite.com/search/result/form_handler

This will call a controller called search.php and run method/function [result]. Using the inflector helper you change the uri parameter for search
Code:
$this->load->helper('inflector');

$s = $this->uri->segment(3,FALSE);
$s = humanize($s);

Now you would have the search term in the $s variable, just as you would with get. This message board is running CI as well, look at how the URI's are structured.




Theme © iAndrew 2016 - Forum software by © MyBB