Welcome Guest, Not a member yet? Register   Sign In
Is it impossible to redirect back or to another route with POST method request?
#1

I got an error when I wanted to redirect back with a 404 error. So I created a route 1 url with 3 different HTTP requests. I want to redirect with the POST request method but the return one is always GET method request. Is it impossible to redirect back using the POST method?
Reply
#2

Have you try this?
PHP Code:
return redirect()->back()->withInput()->with('errors'$this->validator->getErrors()); 

Can you show what your tried and what version of CI, 3 or 4?
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

(11-02-2020, 03:04 PM)includebeer Wrote: Have you try this?
PHP Code:
return redirect()->back()->withInput()->with('errors'$this->validator->getErrors()); 

Can you show what your tried and what version of CI, 3 or 4?
I've tried this method with a slightly different code. but the 404 File not Found error always appears. Because I'm doing a redirect from the PUT request routes back to the route with POST request.

My Code : 

PHP Code:
$validation = \Config\Services::validation():
return 
redirect()->back()->withInput()->with('validation'$validation); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB