Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/05/2015, 12:16
rudiaz
 
Fecha de Ingreso: abril-2015
Ubicación: Santiago de Chile
Mensajes: 80
Antigüedad: 9 años, 11 meses
Puntos: 0
Respuesta: Alguien me puede explicar porque no va a la funcion guardar()

Aca va en dos tandas el programa:

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. function guardar(){
  37. var envio="";
  38. envio=envio +"numero_unico=" + datos_ingreso.numero_unico.value +"&"
  39. envio=envio +"nombre_usuario=" + datos_ingreso.nombre_usuario.value +"&"
  40. envio=envio +"contrasena=" + datos_ingreso.contrasena.value +"&"
  41. envio=envio +"tipo_equipo=" + datos_ingreso.tipo_equipo.value +"&"
  42. envio=envio +"ip_equipo=" + datos_ingreso.ip_equipo.value +"&"
  43. envio=envio +"propietario=" + datos_ingreso.propietario.value +"&"
  44. envio=envio +"email=" + datos_ingreso.email.value +"&"
  45. envio=envio +"clave_correo=" + datos_ingreso.clave_correo.value +"&"
  46. envio=envio +"detalle=" + datos_ingreso.detalle.value +"&"
  47. window.location.href="guarda_equipos.php?"+envio;
  48. }
  49. </script>
  50.   <head>
  51.  
  52.     <title>Ingreso de Equipos</title>
  53.  
  54.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  55. <!--
  56. .Estilo1 {
  57.     font-size: 18px;
  58.     color: #FFFFFF;
  59. }
  60. .Estilo3 {color: #FFFFFF}
  61. .Estilo4 {
  62.     font-size: 16px;
  63.     color: #FFFFFF;
  64. }
  65. -->
  66.     </style>
  67.     <style type="text/css">
  68. <!--
  69. .Estilo4 {font-size: 36px}
  70. .Estilo5 {font-size: 18px}
  71. .Estilo6 {font-size: 24px}
  72. -->
  73.     </style>
  74. </head>
  75.   <body>
  76.   <p>
  77.     <?
  78. /* include "encabezado.php"; */
  79. ?>
  80.   </p>
  81.   <table border="0">
  82.     <tr>
  83.       <th scope="col"><img src="imagenes/logoinformatica.jpg" width="182" height="53" /></th>
  84.       <th scope="col"><span class="Estilo3 Estilo4">&quot;Ingreso de Equipos&quot;</span></th>
  85.     </tr>
  86.   </table>
  87.   <p><br>
  88.     <br>
  89. </p>
  90.   <div class="content">
  91.     <form method="POST" name="form1" action="ingreso_stock.php">
  92. <table border="1" width="100%">
  93. <tr>
  94.   <td colspan="2" bgcolor="#00FFFF"><span class="Estilo1 Estilo6">Usuario</span></td>
  95.   </tr>
  96. <tr>
  97.   <td bgcolor="#00FFFF"><span class="Estilo5">Seleccione el usuario
  98.    
  99.   </span></td>
  100.   <td bgcolor="#00FFFF">
  101.   <select name="usuario" onkeypress="return tabular(event,this)">
  102. <? //por área
  103. $result = mysql_query("SELECT * FROM usuarios  WHERE  vigente ='S' order by nombre_largo");
  104. if (mysql_num_rows($result)>0){
  105.    $i=0;
  106.    $rows=mysql_num_rows($result);
  107.    while($i < $rows) {
  108.    
  109.       if ($_POST["usuario"]==mysql_result($result, $i, "num_unico")){
  110.         echo("<option selected value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>");
  111.         }else{
  112.         echo("<option value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>");
  113.         }
  114.    $i++;
  115.    }
  116. }
  117. ?>
  118. </select></td>
  119. </tr>
  120. </table>
  121. <input type="submit" value="Mostrar">
  122. </form>
  123.  
  124. <?
  125. if ($_POST["usuario"]!=""){
  126. //selecciona usuario a modificar
  127. $result = mysql_query("SELECT * FROM usuarios WHERE num_unico=".$_POST["usuario"]);
  128. if (mysql_num_rows($result)>0){
  129.     $nombre_largo=mysql_result($result,0, "Nombre_largo");
  130.     $sucursal=mysql_result($result,0, "Sucursal");
  131.     $c_usados=mysql_result($result,0,"c_usados");
  132.     $c_ford_nuevos=mysql_result($result,0,"c_ford_nuevos");
  133.     $hyundai=mysql_result($result,0,"Hyundai");
  134.     $global=mysql_result($result,0,"Global");
  135.     $u_livianos=mysql_result($result,0,"u_livianos");
  136.     $ford_livianos=mysql_result($result,0,"ford_livianos");
  137.     $fortaleza=mysql_result($result,0,"fortaleza");
  138.     $fortaleza_camiones=mysql_result($result,0,"fortaleza_camiones");
  139.     $motos=mysql_result($result,0,"Motos");
  140.     $rentacar=mysql_result($result,0,"rentacar");
  141.     $agricola=mysql_result($result,0,"agricola");
  142.     $sin_area=mysql_result($result,0,"sin_area");
  143.     $nombre_user=mysql_result($result,0, "Nombre_Usuario");
  144.     $pass=mysql_result($result,0, "Clave_ing");
  145.     $nivel=mysql_result($result,0, "Nivel");
  146.     $cargo=mysql_result($result,0, "cargo_coti");
  147.     $celular=mysql_result($result,0, "celular_coti");
  148.     $email=mysql_result($result,0, "email");
  149.     $num_unico=mysql_result($result,0, "num_unico");
  150.     $fono_fijo=mysql_result($result,0, "Fono_Fijo");
  151. }
  152. echo("<br>");
  153. echo("<form method=POST name=datos_ingreso>");
  154. echo("<input type=hidden value=".$_POST["usuario"]." name=num_actual>");
  155. echo("<table border=1 width=100%>");
  156. echo("<tr>");
  157. echo("</tr>");
  158. echo("<td colspan='2' bgcolor='#00FFFF'><span class='Estilo1 Estilo6'>Datos de Usuario</span></td>");
  159. echo("</tr>");
  160.  
  161. echo("<table border=1 width=100%>");
  162. echo("<tr>");
  163. echo("</tr>");
  164. echo("  <td>Nombre Completo</td>");
  165. echo("  <td><input type=text value=".chr(34).$nombre_largo.chr(34)." name=nombre_largo size=20 maxlength=20 onkeypress=".chr(34)."return tabular(event,this)".chr(34)."></td>");
  166. echo("</tr>");
  167. echo("<tr>");
  168. echo("  <td>Sucursal</td>");
  169. echo("  <td>");
  170. echo("  <select name=sucursal onkeypress=".chr(34)."return tabular(event,this)".chr(34).">");
  171. $result = mysql_query("SELECT * FROM mae_ubicaciones WHERE sucursal ='S' order by Ubicacion");
  172. if (mysql_num_rows($result)>0){
  173.    $i=0;
  174.    $rows=mysql_num_rows($result);
  175.    while($i < $rows) {
  176.       if ($sucursal==mysql_result($result, $i, "Ubicacion")){
  177.         echo("<option selected value=".chr(34).mysql_result($result, $i, "Ubicacion").chr(34).">".mysql_result($result, $i, "Ubicacion")."</option>");
  178.         }else{
  179.         echo("<option value=".chr(34).mysql_result($result, $i, "Ubicacion").chr(34).">".mysql_result($result, $i, "Ubicacion")."</option>");
  180.         }
  181.    $i++;
  182.    }
  183. }
  184. echo("</select>");
  185. echo("  </td>");
  186. echo("</tr>");
  187. echo("<tr>");
  188. echo("  <td>Contrase&ntilde;a</td>");
  189. echo("  <td><input type=text value=".chr(34).$pass.chr(34)." name=clave size=10 maxlength=10 onkeypress=".chr(34)."return tabular(event,this)".chr(34)."></td>");