Ver Mensaje Individual
  #10 (permalink)  
Antiguo 20/11/2008, 11:54
Avatar de EPROM
EPROM
 
Fecha de Ingreso: abril-2005
Mensajes: 51
Antigüedad: 19 años, 1 mes
Puntos: 3
Respuesta: Obtener filas de una tabla

Si el $row['PROCE_ID'] es único... yo haría esto:


Código:
function cargarDatos(id) {
	document.getElementById('id_seleccionado').value = document.getElementById('row'+id).cells[0].innerHTML;
	document.getElementById('nombre_seleccionado').value = document.getElementById('row'+id).cells[1].innerHTML;
}
</script>
</head>
<body>
<table id="proce" style="border:1px solid #FF0000; color:#000099;width:400px;">
	<thead>
		<tr>
			<th>Id</th>
			<th>Procedimiento</th>
			<th>Seleccionar</th>
		</tr>
	</thead>
	<tbody>
	<?php
	while($row=mysql_fetch_array($consulta)){?>
		<tr id="row<?php echo $row['PROCE_ID'] ?>">
			<td><?php echo $row['PROCE_ID'] ?></td>
			<td><?php echo $row['PROCE_NOMBRE'] ?></td>
			<td><a href="javascript:cargarDatos(<?php echo $row['PROCE_ID'] ?>)">Cargar Input</a></td>
		</tr>
	<?php } ?>
	</tbody>
</table>
<br/>
<input type="text" name="id_seleccionado" id="id_seleccionado" value=""/>
<input type="text" name="nombre_seleccionado" id="nombre_seleccionado" value=""/>
</body>