Ver Mensaje Individual
  #6 (permalink)  
Antiguo 19/10/2011, 07:35
Avatar de CesarHC
CesarHC
 
Fecha de Ingreso: junio-2011
Ubicación: localhost
Mensajes: 566
Antigüedad: 13 años, 4 meses
Puntos: 56
Respuesta: Selecionar una fila de una lista de datos.

Recien lo probe hoy y va bien, aqui esta el codigo de como quedo talvez sirva a alguien, solo me queda pendiente el modificar.

Código HTML:
Ver original
  1. <form action="frmprueba.php" method="post" enctype="multipart/form-data" name="formulario">  
  2. <h1 align="center" class="titulo">PRUEBA</h1>
  3. <table  align="center" id="datos" >
  4. <tr>
  5.     <th></th>
  6.     <td><input name="idprueba" type="hidden" size="430" value="<?php echo $idprueba=$_GET['idprueba']?>" > </td>
  7.   </tr>
  8.   <tr>
  9.     <th>Nombre</th>
  10.     <td><input type="text" id="nombre"  size="30" name="nombre" value="<?php echo $nombre=$_GET['nombre']?>"/></td>  
  11.   </tr>
  12.   <tr>
  13.     <th>Apellido</th>
  14.     <td><input type="text" id="apellido"  size="30" name="apellido" value="<?php echo $apellido=$_GET['apellido']?>"/></td>  
  15.   </tr>
  16.     <td colspan="2" align="center"><input name="submit" type="submit" value="Modificar" id="button"></td>
  17.     </tr></table>
  18.  
  19. </form>

Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4.  
  5. $link = mysql_connect("localhost", "root","");
  6. mysql_select_db("reqcot", $link);  
  7. $result = mysql_query("SELECT idprueba ,nombre, apellido FROM prueba ORDER BY idprueba DESC LIMIT 5; ", $link);
  8. if ($row = mysql_fetch_array($result)){
  9.  
  10.    echo "<table width='200' border='1' align='center'>
  11.    <td align='center'>Nombre</td>
  12.    <td align='center'>Apellido</td>
  13.     <td align='center' >Accion</td> \n";
  14.    
  15.    do {
  16.       echo "
  17.  <tr>
  18.    <td align='center'>".$row["nombre"]."</td>
  19.    <td align='center'>".$row["apellido"]."</td>
  20.     <td align='center'><form action='frmprueba.php' method='get'>
  21.         <input type='hidden' name='idprueba' value=".$row["idprueba"]." />
  22.          <input type='hidden' name='nombre' value=".$row["nombre"]." />
  23.          <input type='hidden' name='apellido' value=".$row["apellido"]." />
  24.         <input type='submit' value='Seleccionar Registro' name='seleccionar' />
  25. </form></td>
  26.  </tr>
  27.       ";
  28.    } while ($row = mysql_fetch_array($result));
  29.    echo "</table> \n";
  30. } else {
  31. echo "¡ No se ha encontrado ningún registro !";
  32. }
  33. ?>
__________________
Solo la práctica no te traicionara ¡¡¡¡¡¡

Seguir el camino tu debes PHP The Right Way.