Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/08/2005, 19:19
Avatar de flaviovich
flaviovich
 
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 2.951
Antigüedad: 18 años, 8 meses
Puntos: 39
Creo que esto puede ayudarte.

Código PHP:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
    
include "config.php";    //aqui va lo necesario para conectarse a la BD
    
    
if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
        
$sql "SELECT * FROM clientes WHERE id_cat = "$_POST['categoria'] .";";
        
$clientes mysql_query($sql);
        if (
$clientes)
        {
            while (
$fila mysql_fetch_array($clientes))
            {
                
//muestras los clientes
            
}
        }
    }
?>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
  <select name="categoria">
<?
    $sql 
"SELECT * FROM categorias;";
    
$categ mysql_query($sql);
    
    if (
$categ)
    {
        while (
$fila mysql_fetch_array($categ))
        {
?>
        <option value="<? print $fila["id"]; ?>" onChange="this.form.submit();"><? print $fila["nombre"]; ?></option>
<?
        
}
    }
?>
  </select>
</form>
</body>
</html>