Redirect Back with Value |
Hi,
Is it possible to use redirect()->back(), with a value. I have a process that requires 2 forms. Form 1 allows the user to define a date and passes it to Form 2 Form 2 retrieves data from the database (based on the date from Form 1) , allows the user to manipulate the data, then writes the result back to the database. The problem is, I cannot redirect()->back() during the write process as I get cuaght in an infinite loop. I understand why I get caught in the loop, I'm just wondering if there is a way of passiing a value back with the redirect, so I avoid the infinite loop??? Any suggestions please Form 1 - View PHP Code: <form action="Form2" method="POST" enctype="multipart/form-data"> Form 2 - Controller PHP Code: class Form2 extends BaseController { Form 2 - View PHP Code: <form action="Form2/update" method="POST" enctype="multipart/form-data">
You can try this it uses the old in the froms.
PHP Code: // Keep the old input values upon redirect so they can be used by the `old()` function What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thank you.
I use this all the time, and it works very well. The issue is, that when Code: return redirect()->back()->withInput(); Is there a way of passing the original variable in the redirect so my controller can process?
"68thorby68" Are you solved this issue ? I have simmilar problem. I have one FORM in step 1 and some validation there. It's working fine. But when user go to Step 2 form and I want to make some validation there I cant. If I use route_to it will return to step 1 instead to step 2 and with back method it's infinite loop as you described.
(01-24-2022, 07:05 AM)jozefrebjak Wrote: "68thorby68" Are you solved this issue ? I have simmilar problem. I have one FORM in step 1 and some validation there. It's working fine. But when user go to Step 2 form and I want to make some validation there I cant. If I use route_to it will return to step 1 instead to step 2 and with back method it's infinite loop as you described. Maybe you can manipulate the reason of the loop. Is there something in the request like checking the button which was clicked, or a hidden filed? Or you can stop the loop by check for the error-data? Just some ideas ;-) |
Welcome Guest, Not a member yet? Register Sign In |