Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
by qadeerbk » Sun Sep 29, 2002 9:44 am
I am trying to use foreach loop on HTTP_POST_VARS
like
foreach( $HTTP_POST_VARS as $key => $value)
$list[$fieldName] = $value;
But I am getting the followinf error message on this line I mean on "foreach"
Warning: Invalid argument supplied for foreach() in .......
Any suggestion please
Thank you in advance
-
qadeerbk
- New php-forum User

-
- Posts: 7
- Joined: Sun Sep 29, 2002 9:36 am
by serge » Sun Sep 29, 2002 11:39 pm

Think about this code:
- Code: Select all
echo "Values submitted via POST method:<br>";
while ( list( $key, $val ) = each( $HTTP_POST_VARS ) )
{
echo "$key => $val<br>";
}
Thanx
------------------------
With best regards,
Serge Bulanov
AlarIT Web developer,
www.AlarIT.com
-
serge
- New php-forum User

-
- Posts: 14
- Joined: Mon Sep 16, 2002 1:25 am
- Location: Ukraine
-
by Jay » Sun Sep 29, 2002 11:48 pm
qadeerbk wrote:Warning: Invalid argument supplied for foreach() in .......
Sounds like the array is empty or non-existant. Use serge's code!
-
Jay
-
Return to PHP coding => General
Who is online
Users browsing this forum: Google [Bot] and 1 guest