I have a problem and I do not know how to solve it, I show my code of a select loaded with mysql data,
<?php
$link = mysqli_connect("localhost", "root", "");
mysqli_select_db($link, "stp17");
$tildes = $link->query("SET NAMES 'utf8'"); //Para que se muestren las tildes correctamente
$resulta = mysqli_query($link, "SELECT * FROM estados where nombre='$nombreDelegacion'");
while ($fila = mysqli_fetch_array($resulta)){
$claveEstado=$fila['clave'];
}
$resultas = mysqli_query($link, "SELECT * FROM rutas WHERE (cveorig='$claveEstado' OR cvedest='$claveEstado') AND cliente='CLI140002'");?>
<div class="input-group">
<span class="input-group-addon">Ruta: </span>
<select name="rutas" id="estados" value="0" class="form-control" onchange="showUser(this.value)">
<?php
while ($fil = mysqli_fetch_array($resultas)){ ?>
<option value="<?php echo $fil['id']; ?>"><?php echo $fil['descripcion']; ?></option>
<?php } ?>
</select>
<span class="input-group-btn">
<a href="rutas/nuevaRuta.php" class="btn btn-success" role="button"><span class="glyphicon glyphicon-plus-sign"></span></a>
</span>
</div>
What I want to do is change the query that I have it so
$resultas = mysqli_query($link, "SELECT * FROM rutas WHERE (cveorig='$claveEstado' OR cvedest='$claveEstado') AND cliente='CLI140002'");?>
To a query like this:
$resultas = mysqli_query($link, "SELECT * FROM rutas");
All this clicking on a checkbox, when I have selected it, it shows me the second query and when I do not have it selected it shows me the first query