Send values from an H5 tag to a variable in PHP

-1

Good afternoon 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 in to another page in PHP that will insert the information in the database, however do not know how to get this information with PHP. If you can give me a light, thank you!

Follow 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>";
  }
    
asked by anonymous 20.05.2018 / 20:40

2 answers

0

The information that is inside the h5 vc already has them since it comes from the bank and you use the vehicle, just take the plate and consult the bank to get this information.

But if you want to show this information to the user and let him edit them to be saved in the bank, you need to put them in:

     <input type="text" name="cor" value="<?php echo $veiculo->cor;?>">
    
20.05.2018 / 21:17
0

You need to put the textarea inside a form and put a name attribute in textarea, example name="mensagem" . To get the information you should use for example $_POST['mensagem'] .

    
20.05.2018 / 21:04