post
poster: Thetawaves
description: html form checkbox code
language: plain text
[download]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
### checkbox generation code
### <input type='checkbox' name='mid_1' value='yes'>
foreach ($menus as $mid => $menu)
{
    print form::checkbox('mid_' . $mid) . form::label('mid_' . $mid, $menu) . "<br>";
}

### here is the code i use to extract the mids
### there has got to be a better way!
$menus_requested = array();
$menu_post_entries = array_keys(array_map(create_function('$menus', 'return substr($menus, 0, 4);') , $post_keys), 'mid_');
foreach ($menu_post_entries AS $tmp)
{
    $menus_requested[] = substr($post_keys[$tmp], 4);
}