Hola grax, el código funciona perfecto, excepto por unos detalles.
1. Cuando selecciono Ver Todos, no hace nada lo cual deberia de mostrar todos los registro parece que no carga el onchange, pero si funciona 10 a 20 y 21 a 30
2. Lo otro como lo separo por tablas, cuando lo muestro todos los registros, ordenado por tablas 10 a 20 y 21 a 30, dos tablas.
Código PHP:
<?php
include("conex.phtml");
$link=Conectarse();
echo "
<form action='select4.php' method='post'>
<select name='operacion' onchange='this.form.submit();'>
<option value=''>Ver Todos</option>
<option value='where edad between 10 and 20'>10 a 20</option>
<option value='where edad between 21 and 30'>21 a 30</option>
</select>
</form>
";
$valor = $_REQUEST['operacion'];
//echo $valor;
$result=mysql_query("select * from personas $valor",$link);
echo "<table border=1>";
while($row = mysql_fetch_array($result)) {
$id = $row["id"];
$nombre = $row["nombre"];
$edad = $row["edad"];
echo "
<tr>
<td>$id </td>
<td>$nombre </td>
<td>$edad </td>
</tr>
";
}
echo "<table>";
?>