RE: [PHP] Comparing form variables using a loop
| From: | Krznaric Michael | Date: | Tue, 15 Aug 2000 15:54:05 +0000 |
| Subject: | RE: [PHP] Comparing form variables using a loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11830@lists.php.net to get a copy of this message | ||
Well if you already know then range to loop through you can try something
along the lines of
loop start
$Current ="$D[x]_[y]SHOW"; //So your string should dynamically contain
//values such as D0_0600SHOW,
D1_0600SHOW
//You can figure out how to assemble
it to
//contain the proper string.
$Next = "$D[x++]_[y++]SHOW"; //Same thing, assemble a string for the
//other part
Now $Current should be a string like D0_0600SHOW and $Next should also be a
smilar string. Whatever you need it to be. Then you can say
if $$Current=$$Next
end loop
I'm not sure if thats what you were looking for, but there you have
dynamically created variables. Otherwise called as "variable variables".
See
http://www.php.net/manual/language.variables.variable.php
Mike
-----Original Message-----
From: J. Myers [mailto:jr@mediastop.com]
Sent: Tuesday, August 15, 2000 11:34 AM
To: php-general@lists.php.net
Subject: [PHP] Comparing form variables using a loop
Hi again,
We're submitting a form containing a lot of variables that we would like
to compare using a loop.
Here's what it looks like:
Form variables:
D0_0600SHOW = "Crow"
D1_0600SHOW = "Crow"
D0_0630SHOW = "Bat"
D1_0630SHOW = "Dog"
Script:
Eg.
Loop Start
if $D[x]_[y]SHOW == $D[x++]_[y++]SHOW
Loop Stop
What it is we wish to accomplish is to have PHP reference the values of
the submitted variables
dynamically.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net