I'm using Slim framework for the first time, and so far everything is spot on. But there is one thing I can't seem to get my head around. After posting a form I would like to redirect back to the same page, but it uses a param in the url and I can't get back to it. This is what I have so far:
$app->post('/markets-:game', $authenticated(), function($game) use ($app) {
$request = $app->request();
$id = $request->post('game3');
$app->flash('global', 'game added');
$app->response->redirect($app->urlFor('games.markets', {"game:$id"}));
})->name('games.markets.post');
Any help would be much appreciated. Thanks
urlFor method accepts two parameters:
Try this: