0
Good afternoon, you guys,
I have some information in a code that is being displayed with the tag inside an Echo, below these, I have a field for free writing, I need to send all these attributes mentioned in tags plus the text that will be typed on to another PHP page that will insert the information in the database, but I don’t know how to get this information with PHP. If you can shed some light, I’d appreciate it!
Follows the script
try {
$veiculo->buscar($placa);
if ($veiculo->existe()) {
//print_r($veiculo->dados());
echo "<div class='row'>
<div class='span12' style='text-align:center; margin: 0 auto;'>
<div class='form-group'>";
echo "<h5>Placa: " . $veiculo->placa."</h5>";
echo "<h5>Marca/Modelo: " .$veiculo->marca."</h5>";
echo "<h5>Cor: " .$veiculo->cor."<h5>";
echo "<h5>Ano: " .$veiculo->ano."</h5>";
echo "<h5>Chassi: " .$veiculo->chassi."</h5>";
echo "<h5>Situação: " .$veiculo->situacao. "</h5>";
echo "<h5>Estado: " .$veiculo->uf. "</h5>";
echo "<h5>Município: " .$veiculo->municipio. "</h5>";
echo "<h5>Mensagem:</h5>";
echo "<textarea class='form-control' rows='5' id='comment'></textarea>";
echo "</div>";
echo"<a href='salvaComment.php' class='btn btn-info' role='button'>Enviar Comentário</a>";
echo"<a href='index.php' class='btn btn-info' role='button'>Pesquise outra placa!</a>";
echo "</div>";
echo "</div>";
echo "</br>";
echo "<h6 align='center'>Data e hora da pesquisa: ".$veiculo->data."</h6>";
}
}catch (\Exception $e) {
echo "<div class='row'>";
echo "<div class='span12' style='text-align:center; margin: 0 auto;'>";
echo "<h5>".$e->getMessage()."</h5>";
echo "</br>";
echo"<a href='index.php' class='btn btn-info' role='button'>Tente novamente!</a>";
}
Yes, as for the textarea I can catch it in PHP making the form, as you mentioned, but I also need the values within each <H5> tag (plate, brand, color, etc...), because in the database, the comments will be assigned according to the car data...
– Lucas Carvalho
I get it, probably what you need is just the license plate, because I imagine it’s your primary key on the table with the vehicle information. You can put an Hidden input with the name attribute on the board. So to save the comment, vc gives a Select in the table by the board and adds the content of the comment.
– Eduardo F G
In fact these data are not yet in the database, as they are searched in an external link, the function that queries in the link creates the class vehicles based on the data that are in the Host, only after being informed the comment that will be inserted in the database, That’s why I wanted to take the H5.
– Lucas Carvalho
Do something similar to: <form action="salvaComment.php" method="post"> <input type="Hidden" name="plate" value="$vehicle->board"> Continue to other data like above </form> In the q file you will receive the data put: <? php echo "board" . $_POST["board"]; ?>
– Eduardo F G
I understood, show the information inside a form even, in this way I had already done. However, as this information will only be for display, I had opted for the H5 tag more for the visual and I would like to know if it was possible to capture these values. However, I will go through the form itself, then I get the visual result I want via CSS. Thank you!
– Lucas Carvalho