The issue is that I have a table that is of hotels and with a while
it brings the name and the price of the hotel in its last position, the matter is that when the user chooses the hotel automatically I throw the price of the hotel hotel, save that price in one variable and multiply it with another select
that only brings me number in people. I leave the code:
<select name="hoteles" class="form-control" id="cont" required> <!--COMBO
BOX hoteles-->
<?php
$consulta = "SELECT hotel,precio FROM 'hoteles_mayas'";
$query=mysqli_query($conexion,$consulta);
while ($fila=mysqli_fetch_array($query,MYSQLI_ASSOC)){
$precio = $fila['precio'];
$hotel = $fila['hotel'];
?>
<option selected value="<?php $precio ?>"><?php echo $hotel ?></option>
<?php
}
mysqli_free_result($query);
?>
</select>
<br>
<input id="selector" name=""></input>
<input id="value"></input>
<br>
<input type="radio" id="" name="tipo_transfer" value="OW"><label id="titulo4">ONE WAY</label>
<input type="radio" id="tipo_transfer_rt" name="tipo_transfer" value="RT"><label id="titulo4">ROUND TRIP </label>
<br>
<span id="tituloCombo">Adults:</span>
<select name="hoteles" class="form-control" id="contN"> <!--COMBO BOX hoteles-->
<?php
$consulta = "select * From numero_clientes";
$query=mysqli_query($conexion,$consulta);
while ($h=mysqli_fetch_array($query,MYSQLI_ASSOC)){
$num_adult = $h['numero_personas'];
?>
<option><?php echo $num_adult ?> </option>
<?php
$coste = $num_adult * $precio;
}
?>
</select>
<br>
<label id="titulo5"> <?php echo '$'. $coste ?></label> <label id="titulo5">USD</label>
<br>
<span id="tituloCombo">Children:</span>
<select name="ninos" class="form-control" id="contN"> <!--COMBO BOX niños-->
<?php
$consulta = "SELECT * FROM numero_clientes";
$query=mysqli_query($conexion,$consulta);
while ($c=mysqli_fetch_array($query,MYSQLI_ASSOC)){
$num_nino =$c['numero_personas'];
$id = $c['id'];
?>
<option><?php echo $num_nino; ?> </option>
<?php
$num = $num_nino;
$precio2 = $num * $precio;
$total = $precio2 + $coste;
}
?>
</select>
<br>
<label id="titulo5"> <?php echo '$'. $precio2 ?></label> <label id="titulo5">USD</label>
<br>
<br>
<label id="titulo5"> Total: <?php echo '$'. $total ?></label> <label id="titulo5">USD</label>