[PHP-ES] Duda con familia y subfamilia

[email protected] ("Irantzu Leunda Biskarret")
Newsgroups php.general.es
Message-ID <DBCEE53AB90E42CC9992F71A02181FB3@Irantzu>
Estimados amigos, tengo una duda, estoy haciendo un catálogo de productos 
donde tengo familias y subfamilias. No todas las familias tienen subfamilias 
y quiero que al crear el producto, al escoger la familia a la que pertenece, 
si tiene subfamilia que me aparezca el desplegable con las subfamilias 
pertenecientes a esa familia y si no tiene, que no aparezca el desplegable.

Les copio la parte del código y les paso la url con usuario y contraseña 
para que puedan verlo.
http://dosalcubo.net/fertor/admin/insertar_producto.php
usuario: fertor
pass: fertor10admin

<tr>
      <td class='txt' width='154' bgcolor='#f2f2f2' height='25'>SELECCIONE 
LA FAMILIA
    </td>
    <td class='px' width='15'>
    </td>

      <td>
        <select name="familia" id="familia">
  <?
  //seleccionar la familia
  include("../variable_con.php");

  $sql="select * from familias_productos order by id";
  $result=mysql_db_query($basedatos,$sql,$link);
  while($row=mysql_fetch_array($result))
  {
   echo " <option value=\"".$row[0]."\">".$row[1]."</option>\n";
        }

  ?>
        </select>
        </td>
        </tr>
        <tr>
    <td class='px' height='10' colspan='3'>
    </td>
   </tr>
      <tr>
      <td class='txt' width='154' bgcolor='#f2f2f2' height='25'>SELECCIONE 
LA SUB-FAMILIA
    </td>
    <td class='px' width='15'>
    </td>

      <td>
        <select name="subfamilia" id="subfamilia">
  <?
  //seleccionar la familia
  include("../variable_con.php");

  $sql="select * from subfamilias_productos where id_familia=$row[id] order 
by id";
  $result=mysql_db_query($basedatos,$sql,$link);
  while($row2=mysql_fetch_array($result))
  {
   echo " <option value=\"".$row2[0]."\">".$row2[2]."</option>\n";
        }

  ?>
        </select>
        </td>
        </tr>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.