I am passing variables of a select; through onchange, but the variables are passed from one page to another. this is my html and I'm on the page ejm.php:
<body>
<select name="miselector" id="miselector" onchange="enviar_valores(this.value);">
<option value="">Seleccionar</option>
<option value="coches">Coches</option>
<option value="casas">Casas</option>
</select>
<script>
function enviar_valores(valor){
//Pasa los parámetros a la pagina buscar
location.href='buscar.php?valor=' + valor;
}
</script>
</body>
then here take the variable and pass it to the search.php page:
<?php
$valor=$_GET['valor'];
echo $valor;
?>
but what I'm looking for is that the variables are passed on the same page, can that be done?