NYCPHP Meetup

NYPHP.org

[nycphp-talk] Cycling through posted variables

Brent Baisley brent at landover.com
Thu Jul 11 10:39:47 EDT 2002


Thanks, I know that works. I should have been clearer. I actually only want
to cycle through some of the fields, not all. For instance, other fields
that are posted are the player ID, Week ID, and number of Games.

So I really want to just grab a subset of all the posted fields, the subset
being the first (or last) x fields, x being the number of games. I know I
could use the loop below with an incrementing variable and an exit, but I
just feel that I'm missing something more elegant.

> 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
> 

-- 
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