Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/05/2015, 09:24
rudiaz
 
Fecha de Ingreso: abril-2015
Ubicación: Santiago de Chile
Mensajes: 80
Antigüedad: 9 años
Puntos: 0
Problemas al ingresar datos a la base de datos

Este es la primera parte del programa, es largo, solo me ingresa num_unico a la base de datos: Por favor ayuda:

Código PHP:
Ver original
  1. <?
  2. ?>
  3. <?
  4. include "conectar.php";
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  7.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8.  
  9. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  10.  
  11. <script language="JavaScript">
  12. function tabular(e,obj) {
  13.   tecla=(document.all) ? e.keyCode : e.which;
  14.   if(tecla!=13) return;
  15.   frm=obj.form;
  16.   for(i=0;i<frm.elements.length;i++)
  17.     if(frm.elements[i]==obj) {
  18.       if (i==frm.elements.length-1) i=-1;
  19.       break }
  20.   frm.elements[i+1].focus();
  21.   return false;
  22. }
  23. function tabular2(e,obj) {
  24.   tecla=(document.all) ? e.keyCode : e.which;
  25.   if (tecla>13 && tecla < 48){return false;}
  26.   if (tecla>57){return false;}
  27.   if(tecla!=13) return;
  28.   frm=obj.form;
  29.   for(i=0;i<frm.elements.length;i++)
  30.     if(frm.elements[i]==obj) {
  31.       if (i==frm.elements.length-1) i=-1;
  32.       break }
  33.   frm.elements[i+1].focus();
  34.   return false;
  35. }
  36. </script>
  37.   <head>
  38.  
  39.     <title>Ingreso de Equipos</title>
  40.  
  41.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  42. <!--
  43. .Estilo1 {
  44.     font-size: 18px;
  45.     color: #FFFFFF;
  46. }
  47. .Estilo3 {color: #FFFFFF}
  48. .Estilo4 {
  49.     font-size: 16px;
  50.     color: #FFFFFF;
  51. }
  52. -->
  53.     </style>
  54.     <style type="text/css">
  55. <!--
  56. .Estilo4 {font-size: 36px}
  57. .Estilo5 {font-size: 18px}
  58. .Estilo6 {font-size: 24px}
  59. -->
  60.     </style>
  61. </head>
  62.   <body>
  63.   <p>
  64.     <?
  65. /* include "encabezado.php"; */
  66. ?>
  67.   </p>
  68.   <table border="0">
  69.     <tr>
  70.       <th scope="col"><img src="imagenes/logoinformatica.jpg" width="182" height="53" /></th>
  71.       <th scope="col"><span class="Estilo3 Estilo4">&quot;Ingreso de Equipos&quot;</span></th>
  72.     </tr>
  73.   </table>
  74.   <p><br>
  75.     <br>
  76. </p>
  77.   <div class="content">
  78.     <form method="POST" name="form1" action="ingreso_stock.php">
  79. <table border="1" width="100%">
  80. <tr>
  81.   <td colspan="2" bgcolor="#00FFFF"><span class="Estilo1 Estilo6">Usuario</span></td>
  82.   </tr>
  83. <tr>
  84.   <td bgcolor="#00FFFF"><span class="Estilo5">Seleccione el usuario
  85.    
  86.   </span></td>
  87.   <td bgcolor="#00FFFF">
  88.   <select name="usuario" onkeypress="return tabular(event,this)">
  89. <? //por área
  90. $result = mysql_query("SELECT * FROM usuarios  WHERE  vigente ='S' order by nombre_largo");
  91. if (mysql_num_rows($result)>0){
  92.    $i=0;
  93.    $rows=mysql_num_rows($result);
  94.    while($i < $rows) {
  95.    
  96.       if ($_POST["usuario"]==mysql_result($result, $i, "num_unico")){
  97.         echo("<option selected value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>");
  98.         }else{
  99.         echo("<option value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>");
  100.         }
  101.    $i++;
  102.    }
  103. }
  104. ?>
  105. </select></td>
  106. </tr>
  107. </table>
  108. <input type="submit" value="Mostrar">
  109. </form>
  110.  
  111. <?
  112. if ($_POST["usuario"]!=""){
  113. //selecciona usuario a modificar
  114. $result = mysql_query("SELECT * FROM usuarios WHERE num_unico=".$_POST["usuario"]);
  115. if (mysql_num_rows($result)>0){