Ver Mensaje Individual
  #10 (permalink)  
Antiguo 07/08/2008, 13:47
Avatar de Ronruby
Ronruby
 
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: problema con $HTTP_POST_VARS

Despues de mucho peliarme con tu codigo logre que las grabara.
A mi lo que me lo resolvio fue cambiar $HTTP_POST_VARS por $_POST
Pero eso depende de la version de PHP que tengas, en mi caso yo tengo la version 5.2.5

Código PHP:
<?php
if (isset($_POST['btnagregar']))
    {
        
$enlace mysql_connect("localhost""root""")or die("No pudo conectarse : " mysql_error());
        
mysql_select_db("sisproed") or die("No pudo seleccionarse la BD.");
        
$txtrut $txtrut."-".$digito;
        
$sqlq "INSERT INTO PROFESOR__PROF( PROF_RUT, CIUD_CODIGO, PROF_NOMBRE, PROF_APELLIDO_PATERNO) VALUES ('".$txtrut."', '".$ciudad."', '".$txtnombre."', '".$txtapellidopaterno."')";
        
$ress=mysql_db_query("sisproed",$sqlq);
            if (!
$ress)
            {
                
$error '<center><h2><strong><pre>No se pudo insertar en la base de datos.</pre></strong></h2></center><br><br>';
            }
            else {
                
$success '<center><h2><strong><pre>El registo fue insertado en la base de datos.</pre></strong></h2></center><br>';
            }
        
    }
?>
<?php 
if(isset($error)) { echo $error; } ?>
<?php 
if(isset($success)) { echo $success; } else {
echo 
'<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form1"><br>';
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"><br>';
echo 
'<tr><br>';
echo 
'<td width="33%" ><pre>Rut Profesor</pre></td><br>';
echo 
'<td width="34%" align="center" ><div align="left"><br>';
echo 
'<input name="txtrut" type="text" value="'.$_POST['txtrut'].'" size="7" maxlength="8"> ';
echo 
'<input name="digito" type="text" value="'.$_POST['digito'].'" size="1" maxlength="1"></td>';
echo 
'</div></td><br>';
echo 
'</tr>';
echo 
'<tr>';
echo 
'<td width="33%"><pre>Nombre Profesor</b></pre></td><br>';
echo 
'<td width="34%" align="center"><div align="left"><br>';
echo 
'<input name="txtnombre" type="text" value="'.$_POST['txtnombre'].'" size="15" maxlength="30"><br>';
echo 
'<input type="submit" name="btnagregar" value="Agregar" /></div></td><br>';
echo 
'</tr>';
echo 
'<tr>';
$enlace mysql_connect("localhost""root""")or die("No pudo conectarse : " mysql_error());
mysql_select_db("sisproed") or die("No pudo seleccionarse la BD.");
$sql1 "SELECT ciud_nombre FROM CIUDAD__CIUD";
$res mysql_query($sql1) or die("La consulta fall&oacute;: " mysql_error());
$num=mysql_numrows($res);
echo 
'<td><pre>Ciudad </pre></td>';
echo 
'<td ><select name="ciudad" id="ciudad">';
echo 
'<option value="">(Seleccione Ciudad)</option>';
for (
$i=0$i<$num$i++)
{
$CIUD_CODIGO=mysql_result($res,$i,"CIUD_CODIGO");
$CIUD_NOMBRE=mysql_result($res,$i,"CIUD_NOMBRE");
echo 
'<option value="'.$CIUD_CODIGO.'">'.$CIUD_NOMBRE.'</option>';
}
echo 
'</select></td>';
echo 
'</tr>';
echo 
'<tr>';
echo 
'<td width="33%"><pre>Apellido Paterno</b></pre></td><br>';
echo 
'<td width="34%" align="center"> <div align="left"><br>';
echo 
'<input name="txtapellidopaterno" type="text" value="" size="15" maxlength="30"><br>';
echo 
'</div></td><br>';
echo 
'</tr>';
echo 
'</table><br>';
echo 
'<center><input type="submit" name="btnagregar" value="Agregar"></center><br>';
echo 
'</form><br>';
echo 
'</body><br>';
echo 
'</html><br>';
}
?>