here's an example of url: http://www.example.com/search/search-keyword
I am trying to make this work, I removed the index.php using .htaccess, search is the controller and I want to pass a parameter in the index method.
this is currently what it looks like:
class Search extends CI_Controller{
function index($param){
echo $param;
}
}
any suggestions? I can't seem to make it work
index
segment http://www.example.com/search/index/search-keyword
.$route['search/(:any)'] = 'search/index/$1';
Remember not to trust user input, especially when you are throwing it into your url. The latest version of CI supports $_GET
variables now, so you may want to look into using that or flashdata. A searh term as simple as O' Brien
will give you a fatal error ("The URI you submitted has disallowed characters.").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With