0
Hello. I have a question where I need to get user information and send it to php. I’m not getting the user’s choice information. He needs to choose whether he’s a client or whether he works in options. I wanted to know if it is possible to send this information, because I have a table called position in the bank where I keep if the user is a client or employee.
Form
<form class="" method="post" action="controleUsuario.php">
<h1 class=""><b>Cadastrar</b></h1>
<div class="form-group"> <label for="nome">Nome:</label> <input type="text" class="form-control" name="nome" id="nome" placeholder="Digite seu nome"> </div>
<div class="form-group"> <label for="email">Email:</label> <input type="text" class="form-control" id="email" name="email" placeholder="Digite seu Email"> </div>
<div class="form-group"> <label for="senha">Senha:</label> <input type="password" class="form-control" id="senha" name="senha" placeholder="Digite sua senha"> </div>
<label class="mr-sm-2 sr-only" for="escolha">Escolha:</label>
<div class="form-row align-items-left">
<div class="col-auto my-1">
<select class="custom-select mr-sm-2" name="escolha" id="escolha">
<option name="cliente" id="cliente" value="Cliente">Cliente</option>
<option name="funcionario" id="funcionario" value="Funcionario">Funcionario</option>
</select>
</div>
</div>
<button type="submit" name="opcao" value="Cadastrar" class="btn btn-primary">Comfirmar</button>
</form>
controlUsuario
if(isset($_POST["opcao"])){
$opcao = $_POST["opcao"];
$escolha = $_POST["escolha"];
if($opcao == "Cadastrar"){
if($escolha=="Funcionario"){
$funcionario=$_POST["funcionario"];
$nome = $_POST["nome"];
$email = $_POST["email"];
$senha =sha1($_POST["senha"]);
cadastroFuncionario($nome,$email,$senha,$funcionario);
header("Location: loginUsuario.php");
}else if($escolha=="Cliente"){
$cliente=$_POST["cliente"];
$nome = $_POST["nome"];
$email = $_POST["email"];
$senha =sha1($_POST["senha"]);
cadastroCliente($nome,$email,$senha,$cliente);
header("Location: loginUsuario.php");
}
}
I don’t get it. $_POST["choice"] works as it should, but what are you trying to access with $_POST["run"] and $_POST["client"]? You’re not sending anything with that name, what should be in these keys?
– Andre
You should have. If he’s working he’ll send "working" for this variable
– Igor Vargas Paes
Why do you need to "run" within $_POST["run"] if you already have "run" within $_POST["choose"]?
– Andre
Man, that confused me had not understood right this $_POST deal
– Igor Vargas Paes