Ver Mensaje Individual
  #9 (permalink)  
Antiguo 20/05/2009, 22:50
inorganico0
 
Fecha de Ingreso: mayo-2006
Ubicación: Ciudad de Buenos Aires
Mensajes: 78
Antigüedad: 18 años
Puntos: 2
Respuesta: no ingresa datos al mysql

Cita:
Iniciado por By_George Ver Mensaje
pues para empezar lo que deberias de modificar no es la configuracion del hosting si no la forma en recibir tus valores, por que por buenas practicas y sobre todo por seguridad(si no es asi que me corrijan) debes de manejar tus valores asi:

$_POST["variable"] o $_GET["variable"] segun sea el caso de con que metodo mandes el dato

ok por que tu action esta asi:

action=\"update.php?accion=guardar\"

si lo que quieres es mandar una bandera que te indique que accion es la que va a realizar mandalo en un campo tipo hidden y ademas todas las variables que mandes por post o get tienes que ecibirlas asi:

$_POST["variable"] o $_GET["variable"] segun ea el caso
Tengo esto y no me deja actualizar, vuelve a mostrarme el formulario:

Código PHP:
<?
include "conexion.php";
$id $_POST["id"];
if (!isset(
$accion))
    {
    
$result=mysql_query("SELECT * FROM biblioa WHERE id = $id",$conexion);
    if (
mysql_num_rows($result) == 0
    { echo 
"<b>Identificador Inexistente</b>"; } 
    else 
    {
        
$row=mysql_fetch_row($result);
        echo
"
<table width=100>
<tr>
  <form action=\"update.php?accion=Guardar\" method=\"POST\" type=\"hidden\">
  <b>Ident:</b><br>
  <input type=\"text\" value=\"$row[1]\" name=\"ident\"><br><br>
  <b>Título:</b><br>
  <input type=\"text\" value=\"$row[2]\" name=\"titulo\"><br><br>
  <b>Autor:</b><br>
  <input type=text value=\"$row[3]\" name=\"autor\" size=50><br><br>
  <b>Artículo:</b><br>
  <input type=text value=\"$row[4]\" name=\"articulo\" size=50><br><br>
  <b>Autor del Artículo:</b><br>
  <input type=\"text\" value=\"$row[5]\" name=\"autorart\" size=15><br><br>
  <b>Código:</b><br>
  <input type=\"text\" value=\"$row[6]\" name=\"codigo\" size=15><br><br>
  <b>Editorial:</b><br>
  <input type=\"text\" value=\"$row[7]\" name=\"editorial\" size=15><br><br>
  <b>Año:</b><br>
  <input type=\"text\" value=\"$row[8]\" name=\"anio\" size=30><br><br>
  <b>Observaciones:</b><br>
  <input type=\"text\" value=\"$row[9]\" name=\"observaciones\" size=100><br><br><br>
  <input type=\"hidden\" name=\"id\" value=\"$row[0]\">
  <input type=\"submit\" value=\"Guardar\">
  </form>
  </tr>
  </table>
  </body>
  </html>"
;
}
}
elseif(
$accion==guardar){
  
$sql "UPDATE biblioa SET ident='{$_POST['ident']}', titulo='{$_POST['titulo']}', autor='{$_POST['autor']}', articulo='{$_POST['articulo']}', autorart='{$_POST['autorart']}', codigo='{$_POST['codigo']}', editorial='{$_POST['editorial']}', anio='{$_POST['anio']}', observaciones='{$_POST['observaciones']}' WHERE id = '{$_POST['id']}'";
  
$result mysql_query($sql);
  echo
"
  <html>
  <body>
  <b>Los datos han sido actualizados</b>
  </body>
  </html>"
;
}
include 
"cerrar_conexion.php";
?>
lo que mencionas de hidden creo haberlo hecho; y lo de $_POST["variable"] o $_GET["variable"] no me lo toma tal cual, me tira error, me sigue ayudando? muchisimas gracias