0
How do I make the item description (coming from the bank) appear in select instead of the phrase "Select Equity Account" I want it to appear: $listar3["DES_CONTA_PATRIMONIAL"] for the selected item.
<select class="form-control" name="contaPatrimonial" onchange="this.form.submit();" <?php if(!isset($_GET["revenda"]) ) { ?> hidden <?php } ?> >
<option value="" disabled selected>Selecione a Conta patrimonial</option>
<?php
$linha3 = $stmt3->fetchAll(PDO::FETCH_ASSOC);
foreach($linha3 as $listar3){
?>
<option value="<?php echo $listar3["CONTA_PATRIMONIAL"]; ?>"> <?php echo utf8_encode($listar3["DES_CONTA_PATRIMONIAL"]);?> </option>
<?php } ?>
</select>
Bench
if ( isset($_GET["revenda"]) ) {
$var1 = $_GET["revenda"];
$query = ("SELECT REVENDA, CONTA_PATRIMONIAL, DES_CONTA_PATRIMONIAL FROM AFX_CONTA_PATRIMONIAL WHERE REVENDA like :rev ");
$stmt3 = $pdo->prepare($query);
$stmt3->bindValue(':rev', '%' . $var1 . '%', PDO::PARAM_STR);
$stmt3->execute();
}
It did not roll.. select had several repetitions of results and is already coming with a preset database item ..
– Fernando Fefu
Oops! Something was missing.
– Leonardo Barros
i would like to keep the phrase "Select the account." and after the user selects the page will update and select stay with the selected result
– Fernando Fefu
I already added what was missing, sorry for the glitch!
– Leonardo Barros
almost worked.. now select ta always getting the first result
– Fernando Fefu
all options are equal?
– Leonardo Barros
no.. are showing the right results.. but when the page updates select is selected in the first item and not in which I selected
– Fernando Fefu
Let’s go continue this discussion in chat.
– Leonardo Barros