I'm having trouble resolving an error that is occurring in slim framework
. I have a contact page that is accessed / p / contact , after accessing and clicking the submit button, it tries to send <form>
via POST to the action "" only it returns me :
Method not allowed.
Method not allowed. Must be one of: GET
I think it's because he's thinking it's GET and I'm sending the form via post.
The route configures, which is calling the view is:
$this->get('/p/{pag_slug}', function($req, $res, $args) {
$Paginas = (new \App\Models\Pagina);
$paginas = $Paginas::orderBy('ordem', 'ASC')->get();
$Informacao = (new \App\Models\Informacao);
$info = $Informacao::first();
if ($args['pag_slug'] == 'contato') {
return $this->view->render($res, 'site/contato.twig', [
'paginas' => $paginas,
'info' => $info,
]);
}
$pagina = $Paginas::where('slug', $args['pag_slug'])->first();
if ($pagina) {
return $this->view->render($res, 'site/pagina.twig', [
'paginas' => $paginas,
'pagina' => $pagina,
'info' => $info,
]);
}
})->setName('site.pagina');
What I need is to get the data typed in the form via post to the url / p / contact