0
Step two variables via GET to a page with a PHP condition, where I extract a new variable that I must send to a second page, but for this second page should go the 3 variables but is sending only the last.
Follow the best explained code.
<form class="got" method="GET" action="real_time.qm.php">
<select name="papel">
<?php
//Recebo as variaveis da outra pagina
$loc = $_GET['loc'];
$ori = $_GET['ori'];
include ("Conectcma.php");
$pl = "SELECT Papel FROM reg_qm_papel WHERE Local = '$loc' AND origem = '$ori'";
$plgo = mysqli_query($conexao, $pl);
while($sc_l = mysqli_fetch_array($plgo)){
echo '<option>'.$sc_l['Papel'].'</option>';
}
?>
</select>
<br>
<br>
<br>
<!-- Ao clicar no botão, deveria retornar as 3 variaveis($_GET['loc'],$_GET['ori'] e papel) porém, só retorna a ultima -->
<button class="css_btn_class" type="submit"> Acessar Papel - QM
</button>
</form>
Hello, you are not writing $Loc or $ori in the "select option", only in the SQL query, so clicking the button will not act on them. If you want to save these two variables and send one more per GET by clicking the button, add the variables in the "select option" or save them in SESSION
– Jhonatan Pereira
In order to send together with the form, you need to place them in form fields, they can be hidden, for example try to use two fields hidden inside your
<form>
:<input name=loc type=hidden value="<?php echo $_GET['loc'];?>"
and<input name=ori type=hidden value="<?php echo $_GET['ori'];?>"
and rescue them with GET– Paulo Roberto Rosa
@Pauloroberto, In your way it worked, thank you very much!
– Geraldão de Rívia