Programming is in object-oriented php and MVC.
I am making a user registry and saving it in the database, however the following error appears:
Call a member function setCode () 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();
}