I’m working on a project with php slim where the step by step is as follows
-
A registration is created with name, email and password (login and client tables are filled in)
-
You are redirected to a page where the confirmation code received by email is informed (validationEmail table is filled in)
-
The system redirects to a portal and the customer can fill in the rest of your registration in the route clients/phaseisind-client-managed/
-
This portal has a page with 3 steps
-
The form in the html has a button that is associated with a javascript function called “changeStep”, this function performs only visual changes on the screen
function changeStep(current, option) {
$('.form-control').removeClass('has-error');
$('.btn').removeClass('has-error');
$('.form-control').removeClass('is-valid');
$('.btn').removeClass('is-valid');
const progressbar = document.querySelectorAll('#progressbar li');
if (option == 'next') {
if (!validateForm(current)) {
return;
}
confirmRegistration(current);
document.getElementById(`step-${current}`).style.display = 'none';
document.getElementById(`step-${current + 1}`).style.display = 'block';
$('html, body').animate({scrollTop: 0}, 'slow');
progressbar[current].classList.add('active');
} else {
document.getElementById(`step-${current}`).style.display = 'none';
document.getElementById(`step-${current - 1}`).style.display = 'block';
$('html, body').animate({scrollTop: 0}, 'slow');
progressbar[current - 1].classList.remove('active')
}
- When clicking on this button, the page loads a loading, it goes to “step 02” however
in the javascript console it gives the error “http://localhost:8080/clientes/dados-cadastrals-ind/1 500
(Internal Server Error)”, so much so that at the end of the form it returns me a “slim application error”
precisely because of this error on the first screen - The route “/data-cadastral-ind/{step}/” was registered in the group of the route “/clientes”, this group
of routes is working normally, so much so that the page is rendered through
of the clients/phaseisind-client-managed route/ of type get that returns the html
file clientes.php
<?php
use \Psr\Http\Message\ResponseInterface as Response; use \Psr\Http\Message\ServerRequestInterface as Request;
$app->get('/', function (Request $request, Response $response) { header('Location: ' . BASEURL . 'clientes'); die(); });
$app->group('/clientes', function () use ($app) {
$app->get('/', fn (Request $request, Response $response) => $this->ClientsController->index($request, $response));
$app->get('/acessos/', fn (Request $request, Response $response) => $this->ClientsController->start($request, $response));
$app->get('/dados-de-acesso/', fn (Request $request, Response $response) => $this->ClientsController->access($request, $response));
$app->get('/cadastro/', fn (Request $request, Response $response) => $this->ClientsController->register($request, $response));
$app->get('/cadastro-finalizado/', fn (Request $request, Response $response) => $this->ClientsController->finishRegister($request, $response));
$app->get('/email-bloqueado/', fn (Request $request, Response $response) => $this->ClientsController->block($request, $response, 0));
$app->get('/conta-bloqueada/', fn (Request $request, Response $response) => $this->ClientsController->block($request, $response, 1));
$app->get('/api/cidades/{state}/', fn (Request $request, Response $response) => $this->ApiController->citiesByState($request, $response));
$app->get('/api/estados/', fn (Request $request, Response $response) => $this->ApiController->getStates($request, $response));
$app->get('/api/cidades-cep/{state}/', fn (Request $request, Response $response) => $this->ApiController->citiesCepByState($request, $response));
$app->get('/api/checkcpf/{checkcpf}/', fn (Request $request, Response $response) => $this->ApiController->checkCpf($request, $response));
$app->post('/registrar/', fn (Request $request, Response $response) => $this->ClientsController->registerSave($request, $response));
$app->post('/dados-de-acesso-email/', fn (Request $request, Response $response) => $this->ClientsController->dataAccessEmail($request, $response));
$app->post('/dados-de-acesso-codigo/', fn (Request $request, Response $response) => $this->ClientsController->dataAccessEmailCode($request, $response));
$app->post('/dados-de-acesso-senha/', fn (Request $request, Response $response) => $this->ClientsController->dataAccessPassword($request, $response));
$app->post('/confirmar-email/', fn (Request $request, Response $response) => $this->ClientsController->confirmEmailRegister($request, $response));
$app->post('/confirmar-dispositivo/', fn (Request $request, Response $response) => $this->ClientsController->confirmDeviceRegister($request, $response));
$app->post('/dados-cadastrais/{step}/', fn (Request $request, Response $response) => $this->ClientsController->clientSave($request, $response));
$app->get('/confirmar-email/{token}/', fn (Request $request, Response $response) => $this->ClientsController->confirmEmail($request, $response));
$app->get('/confirmar-dispositivo/{token}/', fn (Request $request, Response $response) => $this->ClientsController->confirmDevice($request, $response));
$app->get('/novo-cadastro/', fn (Request $request, Response $response) => $this->ClientsController->novoCadastro($request, $response));
$app->post('/novo-cadastro/', fn (Request $request, Response $response) => $this->ClientsController->novoCadastroAutentication($request, $response));
$app->get('/novo-cadastro-logado/', fn (Request $request, Response $response) => $this->ClientsController->novoCadastroLogado($request, $response));
$app->get('/cadastroadd/', fn (Request $request, Response $response) => $this->ClientsController->novoCadastroForm($request, $response));
$app->post('/cadastroadd/{step}/', fn (Request $request, Response $response) => $this->ClientsController->novoCadastroClientSave($request, $response));
$app->get('/cliente-gerenciado/{id}/', fn (Request $request, Response $response) => $this->ClientsController->editClienteGerenciado($request, $response));
$app->get('/etapaum-cliente-gerenciado/', fn (Request $request, Response $response) => $this->ClientsController->etapaUmClienteGerenciado($request, $response));
$app->get('/etapadoisind-cliente-gerenciado/', fn (Request $request, Response $response) => $this->ClientsController->etapaDoisIndividualClienteGerenciado($request, $response));
$app->get('/novocad-etapadoisind-cliente-gerenciado/', fn (Request $request, Response $response) => $this->ClientsController->etapaDoisIndividualClienteGerenciadoNovoCadastro($request, $response));
$app->get('/etapadoiscoi-cliente-gerenciado/{titular}/', fn (Request $request, Response $response) => $this->ClientsController->etapaDoisCoinvestidorClienteGerenciado($request, $response));
$app->get('/novocad-etapadoiscoi-cliente-gerenciado/{titular}/', fn (Request $request, Response $response) => $this->ClientsController->etapaDoisCoinvestidorClienteGerenciadoNovoCadastro($request, $response));
$app->post('/dados-cadastrais-ind/{step}/', fn (Request $request, Response $response) => $this->ClientsController->clientSaveInd($request, $response));
$app->post('/edit-dados-cadastrais-ind/{step}/', fn (Request $request, Response $response) => $this->ClientsController->clientEditSaveInd($request, $response));
$app->post('/dados-cadastrais-coi/{step}/', fn (Request $request, Response $response) => $this->ClientsController->clientSaveCoi($request, $response));
$app->post('/edit-dados-cadastrais-coi/{step}/', fn (Request $request, Response $response) => $this->ClientsController->clientEditSaveCoi($request, $response)); ```