note 14988 added to control-structures.foreach.php
| From: | antti dot inkeroinen at proput dot fi | Date: | Thu, 23 Aug 2001 13:12:27 +0000 |
| Subject: | note 14988 added to control-structures.foreach.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17022@lists.php.net to get a copy of this message | ||
Could someone help me a little. This code should generate one SELECT-list from that logit.txt, but
now it generates many of them...?
...
if($action=="view")
{
$logfile = "logit.txt";
$data=file("$logfile");
foreach ($data as $record) {
$subdata=explode("|",$record);
echo "<FORM ACTION=\"testi3.php\">\n";
echo "<SELECT NAME=\"Joukkueet\">\n";
for ($index =0 ;
$index < count ($subdata[1]);
$index++)
{
echo "<OPTION VALUE=\"$subdata[1]\"> $subdata[1] </OPTION> \n";
}
echo "</SELECT> \n";
echo "</FORM> \n";
}
}
...
http://www.php.net/manual/en/control-structures.foreach.php