foreach loop in php - output teams to drop down menu
For each loop in php. The following code outputs the teams from the array in to a drop down menu.
PHP Code:
<?php
echo "<select name=\"teams\">";

// foreach example - loop through each entry in an array
$teams = array("Brighton","Luton","Swansea","Chelsea");
foreach ( $teams AS $elements )
{
print "<option value=\". $elements .\">". $elements ."</option>;/n";
}
echo "</select>";
?>
Home - Apache - Ubuntu - MySQL - PHP - Misc

The Ubuntu Counter Project - user number # 17415
Updated on: 2008-01-08 07:52:00