Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/02/2010, 11:36
Avatar de andmai
andmai
 
Fecha de Ingreso: enero-2010
Mensajes: 84
Antigüedad: 14 años, 4 meses
Puntos: 1
Al pulsar un botón enviar una variable que no sea del formulario

¡Hola!
¿Qué tal?
Tengo un problema...Estoy haciendo un juego, y quiero que el usuario tenga la opción de modificar su nombre en el juego. Para ello tengo modificarPerfil.php, la cual obtiene la variable del nombre del usuario de una anterior php.


modificarPerfil.php


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Modificar Perfil
</title>
</head>
<link rel="stylesheet" type="text/css" href="estilos.css"/>
<body>
<p class="tituloInicio">Modificar Perfil</p>
<?

foreach( $_POST as $key => $value ) {
echo "<input type='hidden' name='".$key."' value='".$value."'>";
}
//se conecta con la BD
$link = mysql_connect('localhost', 'root');
if (!$link)
{echo " no se puede conectar";}

mysql_select_db("DatosConfiguraciones",$link);

$consulta= "SELECT idPerfil FROM perfil WHERE nombre='value'";
$rdo=mysql_query($consulta,$link);
echo $rdo;
?>

<form method="post" action="guardarDatos.php">
<p class="titulo1">modifica tu nombre</p>
<p class="textoAuxi">nombre:</p>
<input type="text" name="nombre" size="20" class="posicionCaja" >
<br>
<input type="submit" name="boton1" class="botonP" value="Aceptar" onclick=this.form.action='modificarDatos.php'>
<input type="reset" name="boton2" class="botonP" value= "Borrar">
<input class="botonP" type="submit" value="Atras" onclick=this.form.action='perfilPersonal.php'>

</body>
</html>





Mi problema es que cuando el usuario pulsa 'aceptar' envia a modificarDatos.php el nuevo nombre, pero para poder modifcar en la base de datos necesito tb el antiguo nombre.
¿Cómo puedo enviar también a modificarDatos.php el antiguo nombre?



Muchisimas gracias