1
Staff I am developing a system of input and output of vehicles of the company, in the index I made 2 inputs one of entrada
and another saída
, when I click on input appears the registration screen of the vehicle as placa, nome do motorista, data da entrada e hora da entrada
, when you click insert I put to generate a protocol that pulls the id
.
With the exit of the vehicle I was without idea then I decided to do the following, When the vehicle is leaving the company the person clicking there exit to trim a button look, then I put the protocol and appears the license plate of the driver and the name of the same, because I am not able to make the system to search, help me with the system to search, follows below the code of the entry:
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>'); } ?>
HTML CODE OF ENTRY
<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" />
Just a note: we are in 2014, PHP6 is already in development and mysql has already been deprecated (will be removed), this means that an update in your server’s PHP in the future will stop your code from working, which is not very cool, since this is being produced for a company. So be careful to keep the company server using PHP5 or the project will stop working, or alternatively you can use the new functions that replace mysql: the class mysqli and the class PDO. It will still take a few years for PHP6 to launch and be common on servers, but... ;)
– Olimon F.
Thanks for the tip, I will update myself , rsrs.
– Paulo Pimentel