I have a search form on each of my pages. If I use form helper, it defaults to $_POST. I'd like the search term to show up in the URI:
http://example.com/search/KEYWORD
I've been on Google for about an hour, but to no avail. I've only found articles on how $_GET is basically disabled, because of the native URI convention. I can't be the first person to want this kind of functionality, am I? Thanks in advance!
There's a better fix if you're dealing with people without JS enabled.
View:
<?php echo form_open('ad/pre_search');?>
<input type="text" name="keyword" />
</form>
Controller
<?php
function pre_search()
{
redirect('ad/search/.'$this->input->post('keyword'));
}
function search()
{
// do stuff;
}
?>
I have used this a lot of times before.
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