Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/05/2008, 10:47
Rebe22
 
Fecha de Ingreso: octubre-2006
Mensajes: 128
Antigüedad: 17 años, 6 meses
Puntos: 1
Ayuda por favor

Hola a todos!

Os adjunto todo el código de mi página por si alguien me puede echar una manita, el problema que tengo es que quiero sacar un listado con los componentes que hay en una práctica según se selecciona en un iframe superior y poder tener un hueco para poder introducir otro componente más...no sé si me explico el caso es que al hacer el Select * from Kit where practica = practica...no me escribe ningun dato... ¿alguien sabría decirme por qué?

Muchas gracias

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Laboratorio de Electrónica</title>
<style type="text/css">
<!--
body {
	background-color: #C2D0DC;
	
}
.Estilo1 {color: midnightblue}
#capa_CI {	position:absolute;
	width:924px;
	height:89px;
	z-index:3;
	left: 294px;
	top: 122px;
	visibility: hidden;
}
-->
</style>

<script language="javascript"> 


function datos(){

var variable = window.parent.frames["kit_superior"].window.document.getElementById("practica");  
var val = variable.options[variable.selectedIndex].text;
document.getElementById("mipractica").value = val;
document.getElementById("mipracticaenvio").value = val;



}



</script>

<body>

<?php
	echo "<input type='hidden' name='mipractica' id='mipractica'> \n"; 
	
	$practica = $_POST['mipractica'];
	
	$link=mysql_connect("localhost","root","");
	mysql_select_db("laboratorio",$link);	
	
	$result = mysql_query("SELECT * FROM kit where Practica = '$practica'");
		
	echo "<br>";	
	echo "<table border = '0' align='center' class='Estilo1'> \n";
	echo "<tr> \n";
	echo "<td><b>Seleccione el componente que desea: </b></td> \n";
	
	echo "<tr> \n";
	
	echo "<tr> \n";
	
	echo "<tr> \n";
	
	echo "</table> \n";

	echo "<table border = '1' bordercolordark='#000066' align='center' class = 'Estilo'> \n";

	echo "<tr> \n";

	echo "<td align= 'center' class = 'Estilo1'><b>Componente</b></td> \n";

	echo "<td align= 'center'  class = 'Estilo1'><b>Unidades</b></td> \n";

	echo "<td colspan='2' align= 'center'  class = 'Estilo1'> <b> Botones </b></td> \n";

	echo "</tr> \n";

	while ($row = mysql_fetch_row($result)){
	
		
		echo "<tr> \n";
		echo "<td> ";
		$sql = "SELECT componente, Desc1, Desc2, Comentario FROM componentes where codigo_componente = '$row[2]'"; 
		$resul = mysql_query($sql, $link) or die ( mysql_error() ); 
		$opt = '<option value = "%s">%s %s %s %s</option>'; 
		// El especificador s del sprintf presenta una cadena de caracteres.
        //RECORRIDO DEL CURSOR 
	while($row2 = mysql_fetch_array($resul)) 
	{  
 	  	echo sprintf($opt, $row2[0],  $row2[0], $row2[1], $row2[2], $row2[3]); 
	} 
           
		echo "</td>"; 
		echo "<td>$row[3]</td> \n";
		echo "</form> \n";
		
		echo "</tr> \n";
	}
	echo "<tr> \n";
	
	   
	  ?>

 
	  
	  
        <th scope="row"><div align="center">
	<form name="formulario2" method="post" action="anadir_kit.php" onmouseover="datos();">
	
	<input type='hidden' name='mipracticaenvio' id='mipracticaenvio'> 
		 
	<select name="componentes" id="componentes" onchange="document.getElementById('codcomponente').value=this.options[this.selectedIndex].value">

 
<?php 
                       
//OBTENER LOS VALORES DE LAS FILAS 
	$sql = "SELECT codigo_componente, componente, Desc1, Desc2, Comentario FROM componentes ORDER BY codigo_componente ASC"; 
	$resul = mysql_query($sql, $link) or die ( mysql_error() ); 
	$opt = '<option value = "%s">%s %s %s %s</option>'; 

// El especificador s del sprintf presenta una cadena de caracteres.
             
//RECORRIDO DEL CURSOR 
while($row = mysql_fetch_array($resul)) 
{  
   echo sprintf($opt, $row[0],  $row[1], $row[2], $row[3], $row[4]); 
} 
           
?> 
 </select></td> 
 </select></td> 
 <input type="hidden" name="codcomponente" id="codcomponente" />


				
				
		 
		   
        </div></th>
        <td><div align="center">
          <input name="unidades" type="text" id="unidades" />
        </div></td>
        <td><div align="center">
          <input type="submit" name="Alta" value="Alta"/>
		  
        </div></td>
       </form>
	   
      </tr>
	  <tr></tr>
      
  
</table>

</table>


</body> 
</html>