NYCPHP Meetup

NYPHP.org

[nycphp-talk] Cycling through posted variables

Daniel Kushner nyphp at websapp.com
Thu Jul 11 09:29:17 EDT 2002


foreach($_POST as $var => $val) {
	echo "The field named $var has the value $val<br>\
";
}

-----Original Message-----
From: Brent Baisley [mailto:brent at landover.com]
Sent: Thursday, July 11, 2002 9:05 AM
To: NYPHP Talk
Subject: [nycphp-talk] Cycling through posted variables


I'm trying to cycle through the "fields" posted through a form submit. I
need to cycle through the "fields" because I won't know the names of the
fields since the field name actually represents a value. I tried going
through the $HTTP_POST_VARS route and $_POST. Since this is suppose to be an
array, I thought I could cycle through using something like $_POST[0][1],
but this doesn't seem to work.
For testing, if I do $_POST["Game1"], then it works. Any ideas what I'm
doing wrong or a better approach?

Why do I need to do something like this? Well, I'm designing a system to
handle a football pool I manage every year. This piece is for submitting a
users picks for the week. I want the field name to be the Game ID and the
value would be the Team ID. The picks screen uses radio buttons and the user
picks the winner for each game. All games for the week (~12) are displayed
at once for convenience.

I'm using PHP 4.1.2 (on OSX), but can upgrade if need be. I probably should
anyway.

Thanks
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577






More information about the talk mailing list