如何通过复选框输入类型在表格上的一个字段上插入多个值,我使用此代码
<?
function generate_input_checkbox($name,$content)
{
if(is_array($content))
{
if(sizeof($content))
{
foreach($content AS $key => $value)
{
$i = $key + 1;
$boxreturned .= "<div><label for=\"".$name."_$i\">".
"<input type=\"checkbox\" name=\"".$name."[]\" ".
"value=\"$i\" id=\"".$name."_$i\" />$value</label></div>\n";
}
}
}
return $boxreturned;
}
$work = generate_input_checkbox('work',
array('السبت','الاحد','الاثنين','الثلاثاء','الاربعاء','الخميس','الجمعة'));
echo $work;
if(is_array($_POST['work']))
{
foreach ($_POST['work'] AS $worked)
{
$userwork .= $worked.',';
}
}
?>
它保存在字段(数组)而不保存值为什么!!