I am new to codeigniter, I am adding a search function to the site, and had two questions.
- How would I submit a form so that it would be sent as uri segments (like a query string)? I did it before by submitting with post, and redirecting to a url with it in the uri segments. But is there a better way?
- How would I send a string (such as a search query, completely user-generated) through a uri segment? I tried urlencode, but there were still characters that weren’t allowed. I want to keep the bulk of what the query is (so it is easily found in say history, so no base64_encode). Thoughts? Is there a built-in function for this or something?
Thanks for any help,
Max
You would use JavaScript to form the URL, like this:
EDIT: The above answer will not work because of CodeIgniter’s URI filter. However, from my experience with version 1.7, if you pass more than one GET parameter, you can retrieve them using the $_REQUEST array. This will bypass the URI filter altogether. So do this:
Then use $_REQUEST[‘q’] to get your search query. Hopefully this will work for you.