|
Arrays for beginners
| Author | |
| Description | A simple way of explaining the use of array's |
| Rating | (3 votes) |
PHP Code
[#] is the KEY of the array
"..." is the VALUE of the array
$access_level[0] = "Public";
$access_level[5] = "Clan Member";
$access_level[10] = "Administrator";
To display these items in a drop menu of a form:
<?php
echo "<select name="access" size="1">n";
foreach ($access_level as $access_key => $access_value) {
echo "<option value="$access_key">$access_value</option>n";
}
echo "</select>n";
?>
Comments
No comments posted yet.
|