Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2006, 08:15
Avatar de Superlinux
Superlinux
 
Fecha de Ingreso: octubre-2005
Ubicación: Colombia
Mensajes: 662
Antigüedad: 18 años, 6 meses
Puntos: 1
Pregunta Inquietud con popup

... Tengo el siguiente codigo con un popup de encontre el la FAQ. lE HICE ALGUNAS MODIFICACIONES.. La idea es que pase dando clic sobre un boton o enlace el dato tomado de una base de datos Este es el codigo.

Archivo index.php
Código PHP:
html
<
head
    <
title>Formulario beneficiario</title
<
script
var 
miPopup 
function abreVentana(){ 
    
miPopup window.open("beneficiario.php","miwin","width=790,height=540,scrollbars=yes"
    
miPopup.focus() 

</script> 
</head> 
<body> 

<form name=formul> 
  <table cellspacing="3" cellpadding="3" border="0">
    <tr> 
      <td width="333" align="center">NIT</td>
    </tr>
    <tr> 
      <td align="center"> <input type=text name=prefijo value="+" size=40 maxlength=40> 
        <input type="Button" value="?" onclick="abreVentana()"> </td>
    </tr>
  </table> 
</form> 
</body> 
</html> 
Beneficiario.php
Código PHP:
<html> 
<head> 
    <title>Prefijos internacionales</title> 
<script> 
function ponPrefijo(pref){ 
    opener.document.formul.prefijo.value = pref 
    window.close() 

</script> 
</head> 

<body> 
<h1> 
  <?php
//-------------------------------------------------------------------------------------------------------- 
    //Funcion para conectarme a la Base de Datos Mysql
    
    
function conectar() 
     { 
      if (!(
$link=mysql_connect("localhost","root",""))) 
       { 
       echo 
"Error conectando a la base de datos."
       exit(); 
       } 
       if (!
mysql_select_db("sigdoc",$link)) 
        { 
         echo 
"Error seleccionando la base de datos."
         exit(); 
        } 
       return 
$link
     } 
     
$link=conectar(); 
?>
</h1> 
<form name="formu1" method="post" action="">
  <table width="100%" border="0">
    <tr bgcolor="#E1CAEC"> 
      <td width="100%" height="25"> <div align="left"><font color="#000000" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>LISTAR 
          BENEFICIARIOS</strong></font></div></td>
    </tr>
    <tr> 
      <td height="27"> 
        <table width="100%" height="24" border="0" cellspacing=0 bgcolor="#F4F4FF" class=tablaCont>
          <tbody>
            <tr bgcolor="#FFFFFF" class=trmarca> 
              <td width="25%" height="24" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"> 
                <div align="left"><font color="#000000"><strong></strong></font></div></td>
              <td width="19%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><font color="#000000"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Nit 
                o Cedula</font></strong></font></td>
              <td width="56%" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"> 
                <div align="left"><font color="#000000"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Descripcion</font></strong></font></div></td>
            </tr>
          </tbody>
        </table></td>
    </tr>
  </table>
  <?php

// Ejecutar la consulta para obtener los datos de la BD. 
$resultado=mysql_query("SELECT * FROM beneficiario order by descripbenef"); 

// Extraemos y componemos los checbox dinámicos de los datos de nuestra tabla de la BD. 

while ($row mysql_fetch_array($resultado)){ 
?>
  <table width="100%" height="24" 
            border=0 cellpadding=0 cellspacing=0 bgcolor=#F4F4FF>
    <tbody>
    <tr> 
        <td width=751 height="24" align=left bgcolor=F4F4FF> 
          <table width="100%" border="0" cellspacing=0 bgcolor="F4F4FF" class=tablaCont>
            <tbody>
              <tr class=trmarca> 
                <td width="0%" height="33" bgcolor="F4F4FF" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"> 
                  <div align="right"><font color="#000000"> </font></div></td>
                <td width="29%" bgcolor="F4F4FF" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="right"><font color="#771BA9" size="2" face="Arial, Helvetica, sans-serif"><strong><strong><strong><strong><strong><strong> 
                    
                    <input name="Button" type="Button" onclick="ponPrefijo('Aqui deberia pasar el valor tomado por nit')" value=<? echo $row['nit']; ?>>
                    
                </strong></strong></strong></strong></strong></strong></font></div></td>
                <td width="18%" bgcolor="F4F4FF" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="left"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><? echo "<value=\"".$row['nit']."\">".$row['nit']."<br>";?></font></div></td>
                <td width="27%" bgcolor="F4F4FF" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"> 
                  <div align="left"></div>
                  <font size="2" face="Arial, Helvetica, sans-serif"><? echo "<value=\"".$row['nit']."\">".$row['descripbenef']."<br>"?></font></td>
                <td width="26%" bgcolor="F4F4FF" class=CuerpoContC style="PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><div align="left"><font color="#771BA9" size="5"><strong><strong><strong><strong><strong><strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif"> 
                    </font></strong></strong></strong></strong></strong></strong></font></div></td>
              </tr>
            </tbody>
          </table></td>
    </tr>
  </tbody>
</table>
  <?php
}// Fin de while 
?>
</form> 
</body> 
</html>
Gracias por la ayuda ...
__________________
"La vida sigue su curso, tú toma parte de ella."