CodeIgniter Forums
How to handle request method post fields - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to handle request method post fields (/showthread.php?tid=10889)



How to handle request method post fields - El Forum - 08-17-2008

[eluser]Xavier D.[/eluser]
Hi,

I have an issue with a login system.

The login form is available on every page (menu dropdown).

I have a controller "user" with a function "login" to handle the post vars.

The problem is that I need to submit the form to user/login, the login function handles everything and does a redirect to the previous page, looks lide 2 redirections.

1) page -> /user/login 2) /user/login -> previous page

It is working, no problem, but I have a flash with the redirect, not very nice I think.

Is there a solution? So we can handle the post vars, not in the view offcourse. But on another way, whitout the refresh?

thx!


How to handle request method post fields - El Forum - 08-17-2008

[eluser]Xavier D.[/eluser]
I see the codeignitor site is also doing some redirection when logging in and out.

Seems like there is no other way?


How to handle request method post fields - El Forum - 08-17-2008

[eluser]Colin Williams[/eluser]
Just do a 'location' redirect:

Code:
redirect('previous/page', 'location');

And use Session flashdata to store messages so that they persist across HTTP requests.


How to handle request method post fields - El Forum - 08-17-2008

[eluser]Xavier D.[/eluser]
thx! works like a charm Smile