looping inside of a loop
| From: | Rodney Davis | Date: | Wed, 11 Oct 2000 00:03:44 +0000 |
| Subject: | looping inside of a loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19447@lists.php.net to get a copy of this message | ||
I am trying to dynamically generate an option list with the
following script. easy enough but now I need the option
value and the displayed value to be different. The option
value must be in english and the displayed value must
be in Japanese. How do I get $values[0] below into
a loop inside of the original foreach loop so that
"something" and "somethinginjapanese" match?
function writePrefsOptions () {
$prefs = array("something", "somethingelse");
$values = array("somethinginjapanese", "somethingelseinjapanese");
foreach ($prefs as $value) {
print "<OPTION VALUE=\"".($value). "\"";
print (($prefs == ($value))?"selected":"");
print ">$values[0]</option>\n";
}
}
i tried another foreach inside of the foreach loop and it didn't work
as anticipated. What else could i do?
Thanks for your help in advance,
rodney