0
I’m running the order numbers through the charts. After clicking this select, I select the order number in select and want to load the order details on the same page, within a table just below the select. It is possible or I have to send the data through a $_POST to another page and only then upload the order details on the page where I have select?
What I’ve done so far:
<body>
<form id="frm_dados_ljv" name="frm_dados_ljv" method="post" action="">
<p>Número do Pedido:
<select name="cbo_nps" size="1" id="cbo_nps">
<option value="0">Selecione...</option>
<?php
//Conecta o banco de dados e traz as informações dos produtos...
include("conexao.php");
$pdo=conectar();
try{
//Buscando dados...
$sql=$pdo->prepare("SELECT * FROM numped_loja WHERE status='A'");
$sql->bindParam(':idp', $_GET['idp'], PDO::PARAM_INT);
$sql->bindParam(':numped', $_GET['numped'], PDO::PARAM_STR);
$sql->execute();
//loop
while($linha=$sql->fetch(PDO::FETCH_ASSOC)){
//pegando o dado do campo
$numped = $linha["numped"];
//preenchendo a combo...
$np = "<option>".$numped."</option>";
echo $np;
};
//fechando a conexão
$pdo = null;
}
catch(PDOExcception $erro){
echo $erro->getmessage();
}
?>
</select>
</p>
</form>
<div id="tb1_loja"></div>
<div id="tb2_loja"></div>
</body>
you can do using ajax
– adventistaam
Do you have a simple example to guide me? I mean, all on the same page, searching the database?
– xavier
Show what you’ve done
– adventistaam
Okay. Come on: The code exceeds the size here. Where post?
– xavier
If the original code is too big, try reducing the problem to a [mcve]
– hkotsubo
It would be interesting to separate php, html and javascript
– adventistaam