Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/07/2008, 11:42
cearriag
 
Fecha de Ingreso: marzo-2005
Mensajes: 156
Antigüedad: 19 años, 1 mes
Puntos: 0
Rescattar variables

hola.
El problema surge cuando envio un formulario y este me envia un mesaje indicado que me falta ingresar un registri x, por lo que debo volver atras con el browser Y la idea es no perder esos valores que ya he degiitado.
ALgo de codigo de como estoy trabajando:

$r1 = $_POST["txtrut"];
$sq ="select * from Profesor_Prof where Prof_Rut='".$r1."'";
//$res = mysql_query($sql) or die("La consulta falló: " . mysql_error());
$res = mysql_query($sq) or die("La consulta falló: " . mysql_error());
$num=mysql_numrows($res);
echo"$sq";
if($num!=1)
{
echo"$sql";
//if ($pasar==1)
//{
$txtrut=$_POST["txtnombre"];
$txtnombre=$_POST["txtnombre"];
$txtapellidopaterno=$_POST["txtapellidopaterno"];
$txtapellidomaterno=$_POST["txtapellidomaterno"];
//validacion de los campos no esten vacios
//insert
}
Else
{
//Formulario
echo"<form action='ingresar_profesor.php' method='post' enctype='multipart/form-data' name='form1'>\n";
echo"<P>&nbsp;</P>";
echo "<center><h2><strong><pre>Agregar Profesor</pre></strong></h2></center><br><br>";
echo"<table border='0' width='60%' align='center' CELLPADDING = '0' CELLSPACING = '0'>\n";
echo"<tr>\n";
echo"<td width='33%' ><pre>Rut Profesor</pre></td>\n";
echo"<td width='34%' align='center' > <div align='left'>\n";
echo"<input name='txtrut' type='text' value='' onKeyPress='return validar(event)' size='7' maxlength='8'>\n";
echo"<input name='digito' type='text' value='' onKeyPress='return validar(event)' size='1' maxlength='1'></td>";
echo"</div></td>\n";

echo"<td width='33%'><pre>Nombre Profesor</b></pre></td>\n";
echo"<td width='34%' align='center'> <div align='left'>\n";
echo"<input name='txtnombre' type='text' size='15' maxlength='30'>";
//value='<?php =if (isset($_POST['Prof_Nombre'])) echo $_POST['Prof_Nombre']; ?/>'>\n
echo"</div></td>\n";
echo"</tr>\n";
echo"</table>\n";
echo"</form>";

Mas menos eso seria el como toy trabajando con el codigo.
Gracias
}