php中怎么把复选框的值写入MYSQL数据库

数据库的zz表里有这个mudi的字段,为varchar.写到数据库的时候,只能获得最后一个值。怎么能把选中的这些值,都写到这个字段中?并且在前台提取的时候,能够输出选中的... 数据库的zz表里有这个mudi的字段,为varchar.写到数据库的时候,只能获得最后一个值。
怎么能把选中的这些值,都写到这个字段中?
并且在前台提取的时候,能够输出选中的值?
请把具体详细程序写出来。

添加的页面是这样的,具体该怎么改?
<?php
include("userCookie.php");
include("data.ht_inc.php");
include("../include/cls/cls_upload_pic.php");
if($_POST[addok])
{
$arrCP = get_GP(array(lanmu_id, class_id, title, mudi, content, fujianname, paixu));

$db->query("INSERT INTO products (lanmu_id, class_id, title, mudi, imageURL, content, canshuURL, fujianname, fujian, paixu) VALUES ('$arrCP[lanmu_id]', '$arrCP[class_id]', '$arrCP[title]', '$arrCP[mudi]', '$arrCP[imageURL]', '$arrCP[content]', '$arrCP[canshuURL]', '$arrCP[fujianname]', '$arrCP[fujian]', '$arrCP[paixu]')");
alert("添加成功!",$_SERVER['HTTP_REFERER']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="main_top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" align="left">    <span style="font-size:14px; font-weight:bold;"><?php $rtlanmu=$db->get_one("select * from lanmu where lanmu_id=".$_GET[lanmu_id]); echo $rtlanmu[lanmuname]; ?></span></td>
<td align="left"><a href="type_products.php?lanmu_id=<?php echo $_GET[lanmu_id]; ?>" style="font-size:14px; font-weight:bold;">【管理】</a> <a href="type_productsAdd.php?lanmu_id=<?php echo $_GET[lanmu_id]; ?>" style="font-size:14px; font-weight:bold;">【添加】</a> <a href="classcon.php?lanmu_id=<?php echo $_GET[lanmu_id]; ?>&lanmutype=<?php echo $rtlanmu[lanmutype]; ?>" style="font-size:14px; font-weight:bold;">【类别管理】</a></td>
</tr>
</table>
</div>
<table width="750" border="1" borderColorDark="#FFFFFF" borderColorLight="#CDDAED" cellPadding="3" cellSpacing="0">
<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="">
<tr>
<td width="100" height="25" align="right" bgcolor="#EAF2FF">筛分目的:</td>
<td height="25" align="left">
<input name="mudi" type="checkbox" value="去除杂质" checked /> 去除杂质
<input name="mudi" type="checkbox" value="分级" checked />
分级
<input name="mudi" type="checkbox" value="整粒" checked />
整粒
<input name="mudi" type="checkbox" value="过滤" checked />
过滤
<input name="mudi" type="checkbox" value="其他" checked />
其他
</td>
</tr>
<tr>
<td width="100" height="25" align="right" bgcolor="#EAF2FF"> </td>
<td height="25" align="left"><input name="addok" type="submit" id="addok" value="提交" />    <input type="reset" name="Submit2" value="重置" /></td>
</tr>
</form>
</table>
<div style="height:20px;"></div>
</body>
</html>
展开
 我来答
烂泥1760
2010-02-05 · TA获得超过381个赞
知道小有建树答主
回答量:407
采纳率:0%
帮助的人:333万
展开全部
用数组方式获取 然后循环插入到数据库
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式