Ver Mensaje Individual
  #12 (permalink)  
Antiguo 23/02/2007, 14:54
Avatar de tricampeon27
tricampeon27
 
Fecha de Ingreso: enero-2007
Ubicación: Macul
Mensajes: 300
Antigüedad: 17 años, 3 meses
Puntos: 0
Re: valores get y post

aca dejo el formulario en cuestio:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Formulario de Ingreso al Sistema </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</HEAD>

<body onload="document.form1.textuser.focus()" bgcolor="#006699" text="#000000">
<div id="Layer1" style="position:absolute; left:122px; top:62px; width:831px; height:25px; z-index:1">
<table width="75%" border="1">
<tr>
<td>
<div align="center"><b><font size="5" color="#FFFFFF">Formulario Para Actualizar Datos De Ejecutivos</font></b></div>
</td>
</tr>

</table>
</div>
<div id="Layer2" style="position:absolute; left:132px; top:119px; width:444px; height:25px; z-index:2">
<form name="form1" method="post" action="actualizarEjecutivo.php">
<table width="94%" border="1">
<tr>
<td><b><font color="#FFFFFF">Ingrese User:</font></b></td>
<td>
<input type="text" name="textuser">
</td>
<td>
<input type="submit" name="Submit" value="Aceptar">
</td>
<td>
<input type="reset" name="Reset" value="Cancelar">
</td>
</tr>

</table>
</form>
</div>
<?php
if($_POST)
{

include("conexion.php");
//conecto a bd y servido
$link=conexion();
$textuser =$HTTP_POST_VARS["textuser"];


/* if(empty($textuser))
{
echo "<I><B><CENTER><div id='Layer3' style='position:absolute; left:160px; top:160px; width:240px; height:55px; z-index:1'><table width='100%' border='5' align=center ><td><font color='#FFFFFF'><CENTER>Debe Ingresar Un Rut</CENTER></td></font></td></font></CENTER></B></I>";
exit;
}*/
//original
//$result= mysql_query("SELECT * FROM usuarios where usuario ='$textuser'");
$result= mysql_query("SELECT * FROM usuarios where usuario ='progesys'");
//$result= mysql_query("SELECT * FROM usuarios where usuario ='MARCELO'");
if ($row = mysql_fetch_array($result))
{
echo "<div id='Layer1' style='position:absolute; left:80px; top:187px; width:500px; height:55px; z-index:1'>";
echo "<form name='form_php' method='GET' action='actualizarEjecutivo.php'>";
echo "<table width='130%' border = '1'> \n";
echo "<tr> \n";
echo "<td><b><font color='#FFFFFF'>Usuario:</font></b></td> \n";
do
{

$usuario=$row[1];
printf("textrow: $usuario <BR>");

//echo "<td>$row[1]</td>\n";/*usuario*/
echo "<td><input type='text' name='usuario' value='$row[1]'></td>\n";/*usuario*/
echo "<td><b><font color='#FFFFFF'>Nombres:</font></b></td> \n";
echo "<td><input type='text' name='nombres' value='$row[2]'></td>\n";/*nombres*/
echo "</tr> \n";
echo "<tr> \n";
echo "<td><b><font color='#FFFFFF'>Apellido Paterno:</font></b></td> \n";/*apellidosP*/
echo "<td><input type='text' name='apellidosP' value='$row[3]'></td>\n";/*apellidosP*/
echo "<td><b><font color='#FFFFFF'>Apellido Materno:</font></b></td> \n";/*apellidosM*/
echo "<td><input type='text' name='apellidosM' value='$row[4]'></td>\n";/*apellidosM*/
echo "</tr> \n";
echo "<tr> \n";
echo "<td><b><font color='#FFFFFF'>Fono:</font></b></td> \n";/*Fono*/
echo "<td><input type='text' name='Fono' value='$row[5]'></td>\n";/*Fono*/
echo "<td><b><font color='#FFFFFF'>Mail:</font></b></td> \n";/*Mail*/
echo "<td><input type='text' name='Mail' value='$row[6]'></td>\n";/*Mail*/
echo "</tr> \n";
echo "<tr> \n";
echo "<td><b><font color='#FFFFFF'>Clave:</font></b></td> \n";/*Clave*/
echo "<td><input type='text' name='clave' value='$row[7]'></td>\n";/*Clave*/
echo "<td><input type='submit' name='Submit' value='Aceptar'></td> \n";/*Botono Aceptar*/
echo "<td><input type='reset' name='Reset' value='Cancelar'></td>\n";/*Botono Cancelar*/
echo "</tr> \n";
echo "</form>\n";
echo "</div> \n";
}
while ($row = mysql_fetch_array($result));

}
else
{

echo "<I><B><CENTER><div id='Layer3' style='position:absolute; left:160px; top:160px; width:240px; height:55px; z-index:1'><table width='100%' border='5' align=center ><td><font color='#FFFFFF'><CENTER>Rut Incorrecto</CENTER></td></font></td></font></CENTER></B></I>";
exit;

}
}
//mysql_free_result($result);
if($_GET)
{
include("conexion.php");
//conecto a bd y servido
$link=conexion();


printf("//////////////usuario: $textuser <BR>");
exit;


$textusuario =$HTTP_GET_VARS["usuario"];
printf("textusuario: $textusuario <BR>");

$textnombres =$HTTP_GET_VARS["nombres"];
$textapellidosP =$HTTP_GET_VARS["apellidosP"];
$textapellidosM =$HTTP_GET_VARS["apellidosM"];
$textFono =$HTTP_GET_VARS["Fono"];
$textMail =$HTTP_GET_VARS["Mail"];
$textclave =$HTTP_GET_VARS["clave"];
/*printf("textusuario: $textusuario <BR>");
printf("textnombres: $textnombres <BR>");
printf("textapellidosP: $textapellidosP <BR>");
printf("textapellidosM: $textapellidosM <BR>");
printf("textFono: $textFono <BR>");
printf("textMail: $textMail <BR>");
printf("textclave: $textclave <BR>");*/

printf("textusuario: $textusuario <BR>");

//actualizo datos de ejecutivos....
//$result= mysql_query(" update usuario set usuario ='$textusuario' where usuario = '$textusuario' and clave = '$textclave'");
$result= mysql_query(" update usuarios set usuario ='$textusuario' where usuario = 'progesys' ");
if (!$result)
{
die('Could not connect: ' . mysql_error());
}
}
?>

</body>
</HTML>