1
The programming is in object-oriented php and MVC.
I am registering users and saving it in the database, but the following error appears:
Call to a Member Function setCodigo() on a non-object in
what is causing this error?
if ($_POST) {
$codigo = isset($_POST["codigo"]) ? $_POST["codigo"] : false;
$nome = isset($_POST["nome"]) ? $_POST["nome"] : false;
$usuario = isset($_POST["usuario"]) ? $_POST["usuario"] : false;
$senha = isset($_POST["senha"]) ? $_POST["senha"] : false;
$usuario->setCodigo($codigo);
$usuario->setNome($nome);
$usuario->setUsuario($usuario);
$usuario->setSenha($senha);
$usuarioDao->salvar($usuario);
header("location: ListaUsuario.php");
exit();
}
Welcome to Sopt, it would be nice for you to edit your question by adding your codes so the staff can help you :D
– Brunno
Welcome to Sopt, please post the class that contains the setCodigo function, so we can help you, you are giving a require correctly, it is with public encapsulation, private... ?
– Cassiano José