Welcome Guest, Not a member yet? Register   Sign In
Redirect w/ params
#1

[eluser]louis w[/eluser]
What is the best way to redirect to a page, with params (post/get).

An example of this would be:
User is at /page/edit and submits a form to /page/save, there are some problems with the post so the form would want to redirect back to /page/edit but keep the POST params so they do not loose their data.

I know i could just include the view right on /page/save, but i like the constancy of keeping the edit form at /page/edit.
#2

[eluser]Pascal Kriete[/eluser]
Since a form won't be repopulated just because there's data in the POST array, you need an intermediate.

One way is it to add it to the session.
On the form page check if the session variables are set - if yes, populated the fields and unset the variables (not the whole session).

On the processing page, if there is an error - add the data to the session. This also works well if you want to include an error message.
#3

[eluser]louis w[/eluser]
Session, good idea.
I know CI sessions have a limitation on the amount of content, do you know how much text 4KB is?

[quote author="inparo" date="1210296434"]Since a form won't be repopulated just because there's data in the POST array, you need an intermediate.

One way is it to add it to the session.
On the form page check if the session variables are set - if yes, populated the fields and unset the variables (not the whole session).

On the processing page, if there is an error - add the data to the session. This also works well if you want to include an error message.[/quote]
#4

[eluser]Pascal Kriete[/eluser]
One byte per character - so 4000 characters. Depends on the encoding of course. In UTF-8 for example, a regular character takes one byte, while something like é takes two (and some asian languages need 3).




Theme © iAndrew 2016 - Forum software by © MyBB