I want to implement a search in codeigniter using the search term in the url string but am having trouble allowing disallowed uri characters (‘ is the main problem)
e.g. http://www.example.com/search/find/search_term/collector’s edition/category/stackoverflow
basically find ‘collector’s edition’ in category ‘stackoverflow’
This throws the URI exception error – even if I encode it with javascript codeigniter unencodes it. Obviously I don’t want to go and allow all characters.
I also want to be able to decode my data when it is returned so I can display the search term in the input box also.
Use a query string rather than fight against CI’s suggested allowed URI characters:
Just make sure you have query strings (
$_GET) enabled:And to grab the search term: