I am developing a system of entry and exit of vehicles of the company, in the index I made 2 inputs one of entrada
and other saída
, when I click on input it appears the screen of register of the vehicle like placa, nome do motorista, data da entrada e hora da entrada
, when click on insert I put it to generate a protocol that pulls from id
.
With the exit of the vehicle I was without idea of it I decided to do the following, When the vehicle is to leave the company the person click there in exit aparacer a search button, from there I put the protocol and the driver's name and the driver's name appears of the same, because I am not able to do the search system, help me with the search system, here is the code below:
if (isset($_POST["enviar"])) {
$placa = isset($_POST["placa"]) ? $_POST["placa"] : '';
$nome = isset($_POST["nome"]) ? $_POST["nome"] : '';
$dataentrada = isset($_POST["dataentrada"]) ? $_POST["dataentrada"] : '';
$horaentrada = isset($_POST["horaentrada"]) ? $_POST["horaentrada"] : '';
$observacao = isset($_POST["observacao"]) ? $_POST["observacao"] : '';
$id = "id";
$sql = "INSERT INTO entrada(placa,nome,dataentrada,horaentrada,observacao) VALUES('$placa','$nome','$dataentrada','$horaentrada','$observacao')";
$resultado = mysql_query($sql);
$sql1 = mysql_query("SELECT * FROM entrada");
$resultado1 = mysql_fetch_array($sql1) or die (mysql_error());
echo ('<center> <b>
Usuário cadastrado com sucesso!
</b> <br />
Seu protocolo é: #' . $resultado1["id"] . ' </center>'); } ?>
INPUT HTML CODE
<form action="" method="post">
Placa: <input type="text" name="placa" /> <br />
Nome do Condutor (0pcional): <input type="text" name="nome" /> <br />
Data de Entrada: <input type="date" name="dataentrada" /> <br />
Hora Entrada: <input type="time" name="horaentrada" /> <br />
Observação: <textarea name="observacao" cols="30"> </textarea> <br />
<input type="submit" name="enviar" value="Registrar" />