Welcome Guest, Not a member yet? Register   Sign In
Route with http verb
#2

Hi,

I recently posted for help with redirect and routing (https://forum.codeigniter.com/thread-77734.html).

Unfortunately it does not seem possible to configure a redirect with parameters that points to a route that interprets the parameters

i.e.

PHP Code:
redirect()->route('named_route/weekending/25-10-2020'); 
or
PHP Code:
redirect()->route('named_route?weekending=25-10-2020'); 
or
PHP Code:
redirect()->to('named_route?weekending=25-10-2020'); 
where a route is (add, get, post, etc)

i.e

PHP Code:
$routes->get('named_route/varName/varValue''myPage::myMethod/parameters'); 
As a workaround I've manually set _ci_previous_url to use with redirect()->back(). It's not ideal, but it is a work around that suits the purpose
PHP Code:
$sessUpdate = [
    
'_ci_previous_url'  => base_url('myPage/myMethod?weekending='.$week_ending)
];

$this->session->set($sessUpdate); 
Reply


Messages In This Thread
Route with http verb - by 68thorby68 - 10-13-2020, 01:52 AM
RE: Route with http verb - by 68thorby68 - 10-14-2020, 04:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB