Welcome Guest, Not a member yet? Register   Sign In
Sending post data?
#1

[eluser]agartzia[/eluser]
Hi!

I was trying to figure out which way is the best to send post data to a controller from a link?

For example, when I click in a "Search all post by user XXX" and it takes me to a search results page.

I've thought of Javascript, but it's somehow a "tricky" solution.

Cheers!
#2

[eluser]xwero[/eluser]
I don't think you want to send post data using a $_GET request Smile

I think you want to build a link that gets the data: http://site.com/user/1/posts or http://site.com/posts/user/1. take a look at the forum links for inspiration (my forum posts).
#3

[eluser]agartzia[/eluser]
[quote author="xwero" date="1202931656"]I don't think you want to send post data using a $_GET request Smile

I think you want to build a link that gets the data: http://site.com/user/1/posts or http://site.com/posts/user/1. take a look at the forum links for inspiration (my forum posts).[/quote]

xwero, as fast as always!

Yep, I want to do a search from a link. I've done a function...

Code:
class Search extends Controller {

    function redirect($controller = 'of', $field = '', $value = '')
    {
            //"magic unexistent function"
            redirect_to($controller, $field, $value);

    }

}

I could code some Javascript, but as I've said, it's not 'clean' enough.

The forum is a good example, as well.
#4

[eluser]xwero[/eluser]
I'm not sure why you want to redirect your search?

If you have input fields you want to send along with the link you are better of with a form than you can send whatever you want.
#5

[eluser]Negligence[/eluser]
Save it to the session, then redirect.
#6

[eluser]agartzia[/eluser]
[quote author="Negligence" date="1202942226"]Save it to the session, then redirect.[/quote]

Hey, that's a good idea... I'll have to modify some of the code, but it's ok.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB