Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/01/2014, 15:24
robertouchiha
 
Fecha de Ingreso: noviembre-2013
Mensajes: 7
Antigüedad: 10 años, 5 meses
Puntos: 0
Respuesta: como guardar valor de select

Código PHP:
Ver original
  1. <?php
  2.  
  3.      mysql_connect("localhost","root","");
  4.      mysql_select_db("usuarios");
  5.    
  6. ?>
  7. <html>
  8.       <head>
  9.             <title>CATALOGO PRUEBA 4</title>
  10.       </head>
  11. <body>
  12.     <form action="guardar.php" method="POST">
  13.          <p align="center"><font color="blue"><h2><marquee behavior="alternate">CATALOGO DE OBRAS</marquee></p></font></h2>
  14.          <body background= "CATOLOGO.jpeg">
  15.          <!--<fieldset>-->
  16.                <!-- <legend align="center">Categoria y Tipo</legend>-->
  17.          <p align="center">Categoria de Obra</p>
  18.          <form method="POST" >
  19.          <div align="center"><select name='categoria' id="categoria" onchange='submit($row_1)'>
  20.          <?php
  21.  
  22.          $sql_1="SELECT id_concept, desc_concept FROM catalogo WHERE id_cat = 1";
  23.          $rec_1=mysql_query($sql_1);
  24.  
  25.          while($row_1=mysql_fetch_array($rec_1))
  26.         {
  27.          echo "<option value='".$row_1['id_concept']."'    ";
  28.  
  29.          if($_POST['categoria']==$row_1['id_concept'])
  30.          echo " SELECTED ";
  31.  
  32.          echo ">";
  33.          echo $row_1['desc_concept'];
  34.          echo "</option>";  
  35.         }?>
  36.          </select>
  37.          </div>
  38.          </form>
  39.          <p align="center"> Tipo de Obra</p>
  40.           <form method="POST" >
  41.          <div align="center"><select name='tipo' id="tipo" onchange='submit($row_2)'>
  42.          <?php
  43.  
  44.          $sql_2="SELECT id_concept, desc_concept FROM catalogo WHERE id_cat = 2";
  45.          $rec_2=mysql_query($sql_2);
  46.  
  47.          while($row_2=mysql_fetch_array($rec_2))
  48.         {
  49.          echo "<option value='".$row_2['id_concept']."' ";
  50.  
  51.          if($_POST['tipo']==$row_2['id_concept'])
  52.          echo " SELECTED ";
  53.  
  54.          echo ">";
  55.          echo $row_2['desc_concept'];
  56.          echo "</option>";  
  57.          }?>
  58.          </select>
  59.          </div>
  60.          </form>
  61.          <p align="center"><label>Nombre:<input type="text" name="nombre" id="nombre"></p></label>
  62.          <!--</fieldset>-->
  63.          <!--<fieldset>-->
  64.           <!--<legend align="center">Cliente</legend>-->
  65.  
  66.          <p align="center">Seleccionar cliente</p>
  67.          <form method="POST" >
  68.          <div align="center"><select name='client' id="cliente" onchange='submit($row_3)'>
  69.          <?php
  70.  
  71.          $sql_3="SELECT * FROM cliente";
  72.          $rec_3=mysql_query($sql_3);
  73.  
  74.          while($row_3=mysql_fetch_array($rec_3))
  75.         {
  76.          echo "<option value='".$row_3['id_cliente']."' ";
  77.  
  78.          if($_POST['client']==$row_3['id_cliente'])
  79.          echo " SELECTED ";
  80.  
  81.          echo ">";
  82.          echo $row_3['razon_social'];
  83.          echo "</option>";  
  84.          }?>
  85.          </select>
  86.          </div>
  87.          </form>
  88.          <div align="center"><textarea name="Observaciones" rows="5" cols="50">Introducir observaiones aqui:</textarea></div><br>
  89.          <p><div align="center"><label>Domicilio:<textarea name="dommicilio" id="domi" rows="1" cols="50">Introducir domicilio aqui:</textarea></div></p>
  90.          <!--</fieldset>-->
  91.          <!--<fieldset>-->
  92.          <!--<legend align="center">Residente y Suplente</legend>-->
  93.          <p align="center">Seleccionar Residente</p>
  94.          <form method="POST" >
  95.          <div align="center"><select name='resident' id="residente" onchange='submit($row_4)'>
  96.          <?php
  97.  
  98.          $sql_4="SELECT * FROM empleado";
  99.           $rec_4=mysql_query($sql_4);
  100.  
  101.           while($row_4=mysql_fetch_array($rec_4))
  102.         {
  103.           echo "<option value='".$row_4['id_empleado']."' ";
  104.  
  105.          if($_POST['resident']==$row_4['id_empleado'])
  106.          echo " SELECTED ";
  107.  
  108.          echo ">";
  109.          echo $row_4['nombre'];
  110.          echo "</option>";  
  111.          }?>
  112.          </select>
  113.          </div>
  114.          </form>
  115.  
  116.          <p align="center">Seleccionar Suplente</p>
  117.          <form method="POST" >
  118.          <div align="center"><select name='suplente' id="suplente" onchange='submit($row_5)'>
  119.          <?php
  120.  
  121.          $sql_5="SELECT * FROM empleado";
  122.          $rec_5=mysql_query($sql_5);
  123.  
  124.          while($row_5=mysql_fetch_array($rec_5))
  125.         {
  126.          echo "<option value='".$row_5['id_empleado']."' ";
  127.  
  128.          if($_POST['suplente']==$row_5['id_empleado'])
  129.          echo " SELECTED ";
  130.  
  131.          echo ">";
  132.          echo $row_5['nombre'];
  133.          echo "</option>";  
  134.          }?>
  135.          </select>
  136.          </div>
  137.          </form>
  138.          <!--</fieldset>-->
  139.  
  140.           <p><input type="submit" value="Enviar informacion">
  141.          <input type="reset" value="borrar todo"></p>
  142.          <img src="jimfer.jpg" WIDTH=250 HEIGHT=100></img>
  143.      </form>
  144. </body>
  145. </html>
al momento de ejecutar el Submit no lo ejecuta, osea no pasa nada de nada y no se que podria ser.