I'm trying to develop an information sellection, where in the end it will form the product code, as shown in the image below.
Butbychoosingthefieldsitadds,butifyouneedtochange,donotdeletetheoldoneitstaysthenewoneisinserted,andsoon.
htmlcode
<div>G<pid="teste"></p></div>
javascript code
$(function(){
$("#cidades").change(function(){
$('#colors div').hide();
$('#'+$(this).val()).show();
});
$("#estados").change(function(){
var id = $(this).val();
$.ajax({
type: "POST",
url:"../../paginas/pesquisa/pesquisa_codigo_giga.php?id="+id,
dataType:"text",
success:function(res){
$("#cidades").children(".cidades").remove();
$("#cidades").append(res);
}
});
});
$("#cidades").change(function(){
var id = $(this).val();
$.ajax({
type: "POST",
url:"../../paginas/pesquisa/pesquisa_codigo_giga_ind_out.php?id="+id,
dataType:"text",
success:function(res){
$("#teste").children(".teste").remove();
$("#teste").append(res);
}
});
});});
php code
<?php
include "../../controle/conexao.php";
$id = $_GET['id'];
$sql = "SELECT * FROM tabela_indoor_outdoor WHERE tabela_indoor_outdoor_id='$id'";
$sql = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($sql)){
$nome = $row['tabela_ind_out_cod_giga'];
echo $nome;
}
?>
I need to select the code in sequence, it will return the values, and if the person changes it, delete the old code and insert the new code.