0
How do I receive information coming from POST form, so that these data enter a decision structure, Example: I have an abstract class with the function of entering the system, but in the form the user has to mark if he is employee or delivery, the class that inherits the method enter before anything else need to know if this login is the employee of the company or the courier, as both will be directed to different screens.
PAGINA INDEX, NÃO COLOQUEI O FORMULARIO PARA NÃO FICAR EXTENSO DEMAIS.
require_once 'Log in.php';
$logging in = new Log in($user, $password); $logging ->setUsuario($_POST['usuario']); $logging->setSenha($_POST['password']);
PAGE LOGIN:
public function __construct($usuario, $senha) {
$this->usuario = $usuario;
$this->senha = $senha;
}
function getUsuario() {
return $this->usuario;
}
function getSenha() {
return $this->senha;
}
function setUsuario($usuario) {
$this->usuario = $usuario;
}
function setSenha($senha) {
$this->senha = $senha;
}
abstract public function Entrar($usuario, $senha);
abstract public function Sair();
abstract public function Erro();
}
LOG IN
class Logar extends Login {
private $con;
public function __construct($usuario, $senha) {
parent::__construct($usuario, $senha);
$this->con = new Conexao();
}
public function Entrar($usuario, $senha) {
parent::Entrar($usuario, $senha);
echo "Método entrar esta funcionando";
}
public function Sair(){
echo "Saindo";
}
public function Erro() {
echo "Erro";
}
}
I believe that is not the correct form, since your class has to have a specific objective, at the time you create the object
Logar
, pass the data of$_POST['varx']
for the methodEntrar
– h3nr1ke
And don’t forget to use
filter_input_array(INPUT_POST, FILTER_DEFAULT);
to avoid Injection– h3nr1ke
Your logic is confused and it seems that you are learning POO and this is what is bothering you in this minimum context has no way to say what you need to do, usually has more things to do ( I think for the little I saw).
– novic
I’m starting to learn POO and have not found any article on the internet that teaches how to receive data from POST
– sol25lua