Welcome Guest, Not a member yet? Register   Sign In
make what i type in the search bar show up in uri after pagnation page #
#1

[eluser]R_Nelson[/eluser]
how can I make what i type in the search bar show up in uri after pagnation page # in the url
#2

[eluser]R_Nelson[/eluser]
I dont need to do this i solved my problem a diffrent way i stored the var into a session and then got it again on the next page!
#3

[eluser]Andreas Karlsson[/eluser]
There is two ways. Ether you do a post first and redirect from that.

Code:
form_open('controller/do_search');

And in the do_search method you:
Code:
$var = $this->input->post('keyword');
redirect('controller/search/' . $var);

And then you fix the redirect with javascript document.location.
That way it works with javascript off an on.

Or you could investigate some kind of .htaccess method and rewrite ?keyword=blabla to your controller/method.
#4

[eluser]snifty[/eluser]
[quote author="Andreas Karlsson" date="1308055732"]

...in the do_search method you:
Code:
$var = $this->input->post('keyword');
redirect('controller/search/' . $var);

And then you fix the redirect with javascript document.location.
That way it works with javascript off an on.
[/quote]

Could I trouble you to expand a bit about the use of Javascript you refer to? I've been using the method you describe here and it seems to work fine. What would using Javascript add?

TIA
#5

[eluser]Andreas Karlsson[/eluser]
If the user presses the back-button after the search he would come to the result again. The javascript fixes that.

I would do something like:
Code:
$('my-seach-form').submit(
    function(event)
    {
        //makes sure the form doesn't post if users browser is slow.
        event.preventDefault();

        //your search keyword
        var keyword = $('#my-seach-input').attr('value');
        
        //where you want the browser to go
        var target = "http://example.com/controller/search/" + keyword;
        
        //send the browser to your target
        [removed].href = target;
    }
);

I have not tested this, but i should work.
See: http://api.jquery.com/submit/ for more info.

edit----
This form seems to remove some javascript. It should be "window . location . href" without the spaces.




Theme © iAndrew 2016 - Forum software by © MyBB