Ver Mensaje Individual
  #14 (permalink)  
Antiguo 24/05/2012, 20:48
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 12 años
Puntos: 320
Respuesta: Mantener el valor de un <select></select> despues de un submit..

Cita:
el segundo script no me da... X_x vaya qproblema esto q quiero hacer..
Código PHP:
Ver original
  1. <?php
  2.  
  3. include ("../conexion.php");
  4.  
  5. $_SESSION['id_enfermedad']=$_POST['id_enfermedad'];
  6. $_SESSION['id_sintoma']=$_POST['id_sintoma'];
  7. $peso=$_POST['peso'];
  8.            
  9. if(isset($_POST['Enviar'])) {    
  10.     $sql2="select id_sintoma,nombre_sintoma from SINTOMAS where id_sintoma='$_POST[id_sintoma]' ";
  11.     $result2=mysql_query($sql2,$conexion) or die(mysql_error());
  12.     while($row2=mysql_fetch_array($result2)) {
  13.         $id2=$row2['id_sintoma'];
  14.         $nombre2=$row2['nombre_sintoma'];
  15.     }
  16.    
  17.     $sql="select id_enfermedad,nombre_enfermedad from ENFERMEDAD where id_enfermedad='$_POST[id_enfermedad]'";
  18.     $result=mysql_query($sql,$conexion) or die(mysql_error());
  19.     while($row=mysql_fetch_array($result)) {
  20.       $id=$row['id_enfermedad'];
  21.       $nombre=$row['nombre_enfermedad'];                  
  22.     }      
  23.    
  24.     $sql = ("INSERT INTO temporal VALUES ('$id','$nombre','$peso','$nombre2')");  
  25.     $rs= mysql_query($sql);
  26.          if($rs == false) {
  27.             echo '<p>Error al pasar el campo.</p>';
  28.         }
  29. header("location: patologia.php");
  30. }
  31. ?>
tenia unos errores de sintaxis ya estan corregidos.
Cita:
solo el pequeño detalle de como posicionarme en el select para hacer el insert..
mm no entendi a lo que te refieres puntualmente
prueba ese codigo aver si te anda saludos.