Ver Mensaje Individual
  #6 (permalink)  
Antiguo 05/05/2005, 09:48
yokoshima
 
Fecha de Ingreso: febrero-2005
Ubicación: chile, Santiasko
Mensajes: 728
Antigüedad: 19 años, 2 meses
Puntos: 1
hola cluster, te comento que ya me funciona....

pero el unico problema es que el combo de adecua al contenido.. y quiero que me salga del mismo porte que el padre, nose si me entienden...

en todo caso me funciona aqui dejo las funciones:
Código PHP:
function LstCategoriaHTML($categoria='',$id='lst_clasificacion'){
$opciones='';
$db=conexion();
$sql="SELECT codcategoria, nombre FROM categoria WHERE nivel=0 ORDER BY nombre";
$rs=$db->Execute($sql);
if (!
$rs) {
$opciones='';
} else {
while(!
$rs->EOF){
$codcat=$rs->fields("codcategoria");
if(
$categoria==$codcat){
$opciones.='<option value="'.$codcat.'" selected>'.$rs->fields("nombre").'</option>';
} else {
$opciones.='<option value="'.$codcat.'">'.$rs->fields("nombre").'</option>';
}
$rs->MoveNext();
}
}
$html='<select name="'.$id.'" size="10" id="'.$id.'" class="listado" onChange="this.form.submit();">';
$html.=$opciones.'</select>';
return 
$html;


function 
LstSubCategoriaHTML($codcategoria='0'$id='lst_subcategoria'){
$opciones='';
$db=conexion();
$sql="SELECT nombre, codcategoria FROM categoria WHERE nivel=1 and categoriapadre='".$codcategoria."' ORDER BY nombre";
$rs=$db->Execute($sql);
if (!
$rs) {
$opciones='';
} else {
while(!
$rs->EOF){
$codcat=$rs->fields("codcategoria");
$opciones.='<option value="'.$codcat.'">'.$rs->fields("nombre").'</option>';
$rs->MoveNext();
}
}
$html='<select name="'.$id.'" size="10" id="'.$id.'" class="listado">';
$html.=$opciones.'</select>';
return 
$html;

y el html
Código HTML:
<?php
include('karpedia.inc.php');
?>

<html>
<head>

<title>Estado</title>

<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="seleccion.php">
  <p align="center" class="style1">Datos Basicos</p>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="12%" class="labeltop"><strong>Categoria:</strong></td>
      <td width="88%"><?php echo LstCategoriaHTML($categoria); ?></td></tr>
	  <tr>
      <td class="labeltop"><strong>Subcategoria:</strong></td>
      <td><?php 
	  $categoriapadre=$_POST['lst_clasificacion'];
	  //echo $categoriapadre;
	  echo LstSubCategoriaHTML($categoriapadre); ?></td>
    </tr>
	</table>
	</form>
	</body>
	</html> 
el problema era que no estaba resibiendo nada del combo principal y por eso no cargaba nada... ojala que alguien le sirva.......

salu2
__________________
Una Vez Muerto el Perro.............Se acaba la Rabia :risa: