Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2006, 08:07
RAMDRIX
 
Fecha de Ingreso: marzo-2006
Mensajes: 12
Antigüedad: 18 años, 1 mes
Puntos: 0
[B]paso de valor de variable con un Combobox[/B]

NECESITO SABER COMO PUEDO GUARDAR EL CODIGO DE LA OPCION SELECCIONADA EN EL COMBOBOX DE CIUDAD POR EJEMPLO
MI TABLA DE CIUDAD
COD_CIUDAD,CIUDAD
22 ,FFF
23,XXX
Y QUE ME GUARDE EN LA OTRA TABLA EXPEDIENTE EL CODIGO 23
CIUDAD XXXX ELIJO Y GUARDO SU CODIGO 23,POR FAVOR


Código PHP:

<html>
<body>
<?php

if ($enviar) {
 include(
"conex.php"); 
 
$link=Conectarse(); 
  
  
$sql "INSERT INTO expediente(cod_referencia,codigo_cliente,cod_gestor,fecha_i,fecha_f,nro_expediente,cod_contribuyente,ubicacion,descripcion,medio_env)VALUES('$cod_referencia','$codigo_cliente','$cod_gestor',$fecha_i','$fecha_f','$nro_expediente','$cod_contribuyente','$ubicacion','$descripcion','$medio_env');
  
   "
;
  
$result mysql_query($sql,$link);

       echo 
"¡Gracias! Hemos recibido sus datos.\n";

}else{

  
?>

   <form method="post" action="PAGINA.php">

     Gestor:<input type="Text" name="nombre"><br>
     Cel1:<input type="Text&quo>Cel1:<input type="Text" name="tel_cel"><br>
     Cel2:<input type="Text&quo>Cel2:<input type="Text" name="cel_2"><br>
     Linea Baja:<input type="Text&quo>Linea Baja:<input type="Text" name="tel_casa"><br>
      Ciudad:<?
                  
include("conex.php"); 
     
$link=Conectarse();

    
$sSQL="Select concat(cod_ciudad,' ', ciudad) as 'Ciudad' From ciudad Order By ciudad";  
    
$result=mysql_db_query("BASDEDEDATOS",$sSQL);
    echo 
'<select name="Ciudad">';
    while (
$row=mysql_fetch_array($result))
    {echo 
'<option>'.$row["Ciudad"];}
    
?>
</select>

     Direccion:<input type="Text&quo>direccion:<input type="Text" name="direccion"><br>
     E-mail:<input type="Text&quo>E-mail:<input type="Text" name="mail"><br>

  <input type="Submit" name="enviar" value="Aceptar información">
<?php
   $result
=mysql_query("select * from gestor",$link);
?>

 <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
      <TR>
         <TD>&nbsp;Gestor</TD>
         <TD>&nbsp;Cel 1&nbsp;</TD>
         <TD>&nbsp;Cel 2&nbsp;</TD>
         <TD>&nbsp;Tel.:&nbsp;</TD>
         <TD>&nbsp;Ciudad&nbsp;</TD>
         <TD>&nbsp;Direccion&nbsp;</TD>
         <TD>&nbspMail&nbsp;</TD>
       </TR>

<?php      
   
while($row mysql_fetch_array($result)) {
printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td></td><td> &nbsp;%s&nbsp; </td></td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td>"$row["nombre"], $row["tel_cel"], $row["cel_2"], $row["tel_casa"], $row["cod_ciudad"], $row["direccion"], $row["mail"]);
   }
   
mysql_free_result($result);
?>

   </form>

  <?php

//end if

?>

</body>

</html>

Última edición por RAMDRIX; 22/03/2006 a las 10:54