I'm having some issues displaying the flash variable via Slim and Twig. When I POST to slim it renders the page without the 'error'. Thoughts?
$app->get('/getintouch', function() use ($app, $settings) {
$app->render('getintouch.html');
});
$app->post('/getintouch', function() use ($app, $settings) {
$name = $app->request->post('name');
if (strlen($name) < 2) {
$app->flash('error', 1);
$app->redirect('/getintouch');
}
});
Slim does not 'flash' error data \
Moderator: General Moderators
Re: Slim does not 'flash' error data \
You can't show a message on the page and redirect away from that page at the same time.
From what I can tell you shouldn't be redirecting at all. Show the error message and redisplay the form.
From what I can tell you shouldn't be redirecting at all. Show the error message and redisplay the form.