SoloCodigo
Programación Web y Scripting => PHP => Mensaje iniciado por: crisarmijo en Miércoles 15 de Septiembre de 2010, 19:55
-
:hitcomp: amigos ayuda!!!
el siguiente codigo tiene estos dos Warning y no logro entender que puede estar pasando...
muchas gracias :comp:
<?php
while(list($key, $val) = each($GLOBALS["HTTP_POST_VARS"]))
$$key = $val;
while(list($key, $val) = each($GLOBALS["HTTP_GET_VARS"]))
$$key = $val;
unset($key, $val);
?>
Warning: Variable passed to each() is not an array or object in C:xamppxampphtdocsSistemaAfiliadoparse_vars.php on line 2
Warning: Variable passed to each() is not an array or object in C:xamppxampphtdocsSistemaAfiliadoparse_vars.php on line 4
-
Lo que pasa es que $GLOBALS['HTTP_POST_VARS'] no es un arreglo, lo que puede estar pasando es que no estás enviando nada desde el formulario del que mandaste llamar ese archivo, intenta con:
<?php
if(is_array($GLOBALS["HTTP_POST_VARS"]) { while(list($key, $val) = each($GLOBALS["HTTP_POST_VARS"])) $$key = $val;
while(list($key, $val) = each($GLOBALS["HTTP_GET_VARS"])) $$key = $val;
}
?>
Recomendación usa $_POST en vez de $GLOBALS["HTTP_POST_VARS"] :)
-
GRACIAS!!!!
:mellow: pero ahora me salio un error de sintaxis
Parse error: syntax error, unexpected '{' in Cora:xamppxampphtdocsSistemaAfiliadoparse_vars.php on line 2
pero solo era un parentesis que le faltaba al "if"
if(is_array($GLOBALS["HTTP_POST_VARS"]))
y ahora no me muestra nada pero me las tengo que arreglar solito, muchas gracias :lol: