I have the following code:
// Dentro do arquivo somar.js
<script>
function soma(){
if(document.getElementById('QtdAcomodacaoSingle').options[0].selected == false){
TextoAcos = (QtdAco == 1)?("passageiro"):("passageiros");
document.getElementById("alterar").innerHTML = QtdAcos + " " + TextoAcos;
......
}
}
</script>
// Página index.php
<select name="QtdAcomodacaoS" id="QtdAcomodacaoSingle" class="form-control" style="width:130px" onchange="soma()">
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</option>
<div id="alterar" style="text-align: center; ">---</div>
When you select the number of accommodations, the selected number in the change div automatically appears. So far so good. However, I want to keep the information on the form that has been registered. I get it in all fields, but how would I make this effect of selecting a number appear in the div change, work after bringing those results in php? I tried this way:
<?php if($_SESSION['Ativo'] == false){ ?>
<div id="alterar" style="text-align: center; ">---</div>
<?php }else{
echo $visualizarS->QtdPax;
}
?>
When I do this, the change div gets stuck inside the session validation.