Posted by Sjoerd on 10/20/50 11:34
<?php
$users = array( 1 => "Alice",
2 => "Bob",
3 => "Charlie",
4 => "Trudy");
echo '<form method="GET">';
foreach ($users as $id => $user) {
echo '<p>';
echo '<input type="checkbox" name="perm[]"
value="'.$id.'">';
echo $user;
echo '</p>';
}
echo '<input type="submit">';
echo '</form>';
if (isset($_GET['perm'])) {
$perm = $_GET['perm'];
foreach ($perm as $userid) {
echo '<br>'.$users[$userid].' is set';
}
} else {
echo '<br>None are set';
}
?>
[Back to original message]
|