Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/11/2011, 19:04
endgel
 
Fecha de Ingreso: diciembre-2010
Mensajes: 26
Antigüedad: 13 años, 4 meses
Puntos: 2
pasar variable php a un campo text de formulario

amigo buenas noches, agradezco su ayuda prestada..

tengo una duda de como usar el GET,

tengo mi archivo buscar.php

Código PHP:
<?php
 
include("conec.php");
   
$link=Conectarse();

$id$_POST['id'];



$prueba mysql_query("select * from corresp where id='$id'");


if(!
$prueba ){
        echo 
"No existe el ID en la BD";

    }else {
            echo 
"<HTML><TABLE Border=10 CellPadding=5><TR>";

# construyendo los encabezados de la tabla

            
echo "<th bgcolor=Green>Id</th><th bgcolor=White>NOMBRE</th><th bgcolor=Red>APELLIDO</th></TR>";

// ciclo de lectura del rowset($prueba)

    
while($renglon mysql_fetch_row($prueba))

{

// desplegando en celda de tabla html

        
echo"<tr>";

        echo 
"<td>".$renglon[0]."</td>";

        echo 
"<td>".$renglon[1]."</td>";

        echo 
"<td>".$renglon[2]."</td>";    

        echo
"</tr>";

};

// cerrando tabla html

echo "</table>";


}
?>

<FORM ACTION=ModificarCorresp.html METHOD=post>

<INPUT TYPE=submit NAME=OK VALUE="EDITAR"><BR>

</FORM></HTML>
el cual mediante un ID busca un registro de nombre y apellido..

al querer editarlo. llamo al formulario ModificarCorresp.html y en el
primer campo, lo puse no editable, pero quiero que me muestre el la variable ID obtenida del archivo BUSCAR.PHP.. no se como pasarla.. lei e intente por url mediante el get, mas nunca pude...


Código HTML:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  3. <title>Documento sin t&iacute;tulo</title>
  4. </head>
  5.  
  6. <?php
  7.     $id = $_GET['id'];
  8.  
  9.     ?>
  10.  
  11. <form method="post" action="modificar1.php">
  12.  
  13. id :     <input type="text" name="id" id="id" readonly="readonly" value="$id" /><br>
  14.  
  15. Nombre : <input type="text" name="nombre"><br>
  16. Apellido : <input type="text" name="apellido"><br>
  17. <br>
  18. <br><br>
  19. <input type="submit" name="modificar" value="Enviar">
  20. </form>
  21. </body>
  22. </html>

que recomendacion me dan???

OJO:La conexion a la BD y la busqueda funcionan 100%