Aca va en dos tandas el programa:
Código PHP:
Ver original<?
?>
<?
include "conectar.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<script language="JavaScript">
function tabular(e,obj) {
tecla=(document.all) ? e.keyCode : e.which;
if(tecla!=13) return;
frm=obj.form;
for(i=0;i<frm.elements.length;i++)
if(frm.elements[i]==obj) {
if (i==frm.elements.length-1) i=-1;
break }
frm.elements[i+1].focus();
return false;
}
function tabular2(e,obj) {
tecla=(document.all) ? e.keyCode : e.which;
if (tecla>13 && tecla < 48){return false;}
if (tecla>57){return false;}
if(tecla!=13) return;
frm=obj.form;
for(i=0;i<frm.elements.length;i++)
if(frm.elements[i]==obj) {
if (i==frm.elements.length-1) i=-1;
break }
frm.elements[i+1].focus();
return false;
}
function guardar(){
var envio="";
envio=envio +"numero_unico=" + datos_ingreso.numero_unico.value +"&"
envio=envio +"nombre_usuario=" + datos_ingreso.nombre_usuario.value +"&"
envio=envio +"contrasena=" + datos_ingreso.contrasena.value +"&"
envio=envio +"tipo_equipo=" + datos_ingreso.tipo_equipo.value +"&"
envio=envio +"ip_equipo=" + datos_ingreso.ip_equipo.value +"&"
envio=envio +"propietario=" + datos_ingreso.propietario.value +"&"
envio=envio +"email=" + datos_ingreso.email.value +"&"
envio=envio +"clave_correo=" + datos_ingreso.clave_correo.value +"&"
envio=envio +"detalle=" + datos_ingreso.detalle.value +"&"
window.location.href="guarda_equipos.php?"+envio;
}
</script>
<head>
<title>Ingreso de Equipos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!--
.Estilo1 {
font-size: 18px;
color: #FFFFFF;
}
.Estilo3 {color: #FFFFFF}
.Estilo4 {
font-size: 16px;
color: #FFFFFF;
}
-->
</style>
<style type="text/css">
<!--
.Estilo4 {font-size: 36px}
.Estilo5 {font-size: 18px}
.Estilo6 {font-size: 24px}
-->
</style>
</head>
<body>
<p>
<?
/* include "encabezado.php"; */
?>
</p>
<table border="0">
<tr>
<th scope="col"><img src="imagenes/logoinformatica.jpg" width="182" height="53" /></th>
<th scope="col"><span class="Estilo3 Estilo4">"Ingreso de Equipos"</span></th>
</tr>
</table>
<p><br>
<br>
</p>
<div class="content">
<form method="POST" name="form1" action="ingreso_stock.php">
<table border="1" width="100%">
<tr>
<td colspan="2" bgcolor="#00FFFF"><span class="Estilo1 Estilo6">Usuario</span></td>
</tr>
<tr>
<td bgcolor="#00FFFF"><span class="Estilo5">Seleccione el usuario
</span></td>
<td bgcolor="#00FFFF">
<select name="usuario" onkeypress="return tabular(event,this)">
<? //por área
$result = mysql_query("SELECT * FROM usuarios WHERE vigente ='S' order by nombre_largo"); $i=0;
while($i < $rows) {
if ($_POST["usuario"]==mysql_result($result, $i, "num_unico")){ echo("<option selected value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>"); }else{
echo("<option value=".mysql_result($result, $i, "num_unico").">".mysql_result($result, $i, "nombre_largo")."</option>"); }
$i++;
}
}
?>
</select></td>
</tr>
</table>
<input type="submit" value="Mostrar">
</form>
<?
if ($_POST["usuario"]!=""){
//selecciona usuario a modificar
$result = mysql_query("SELECT * FROM usuarios WHERE num_unico=".$_POST["usuario"]); $fortaleza_camiones=mysql_result($result,0,"fortaleza_camiones"); }
echo("<br>");
echo("<form method=POST name=datos_ingreso>");
echo("<input type=hidden value=".$_POST["usuario"]." name=num_actual>");
echo("<table border=1 width=100%>");
echo("<tr>");
echo("</tr>");
echo("<td colspan='2' bgcolor='#00FFFF'><span class='Estilo1 Estilo6'>Datos de Usuario</span></td>");
echo("</tr>");
echo("<table border=1 width=100%>");
echo("<tr>");
echo("</tr>");
echo(" <td>Nombre Completo</td>");
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>"); echo("</tr>");
echo("<tr>");
echo(" <td>Sucursal</td>");
echo(" <td>");
echo(" <select name=sucursal onkeypress=".chr(34)."return tabular(event,this)".chr(34).">"); $result = mysql_query("SELECT * FROM mae_ubicaciones WHERE sucursal ='S' order by Ubicacion"); $i=0;
while($i < $rows) {
}else{
}
$i++;
}
}
echo("</select>");
echo(" </td>");
echo("</tr>");
echo("<tr>");
echo(" <td>Contraseña</td>");
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>");