Èç¹ûÒ»¸ö±íµ¥ÖÐÓжà¸öͬÃû¸´Ñ¡¿ò£¬ÔÚÌá½»µ½phpʱȴֻÓÐÒ»¸öÖµ£¬¶ø²¢²»ÏñaspÄÇÑùÊÇÒ»´®ÓöººÅ·Ö¸îµÄÖµ¡£ÓÐÒ»¸öºÜ¼òµ¥µÄ·½·¨À´½â¾ö£º½«¸´Ñ¡¿òµÄnameºóÃæ¼ÓÉÏ[]£¬ÀýÈ磺<input type="checkbox" name="ccc" value="1"> ¸ÄΪ£º<input type="checkbox" name="ccc[]" value="1">¡£ÕâÑùphp½«µÃµ½Ò»¸ö½ÐcccµÄÕóÁС£µ«ÕâÖÖ·½·¨ÓиöÎÊÌ⣬Èç¹ûÄúÒªÔÚ¿Í»§¶Ë¶Ô¸´Ñ¡¿òÊÇ·ñ±»Ñ¡Ôñ¡¢Ñ¡ÔñÁ˼¸¸öÓÃjavascriptÀ´ÅжÏʱ£¬javascript»áÒòΪ¸´Ñ¡¿òµÄnameÖк¬ÓÐ[]¶ø³ö´í¡£Äú¿ÉÒÔÔÚ±íµ¥ÖмÓÈëÒ»¸öÒþº¬Óò£¬ÓÃjavascriptÉèÖÃËüµÄÖµ¡£

<script language="javascript">
function check()
{
var strchoice="";
for(var i=0;i<document.news.choice.length;i++)
{
if (document.news.choice[i].checked)
{
strchoice=strchoice+document.news.choice[i].value+",";
}
}
if (!document.news.choice.length)
{
if (document.news.choice.checked)
{
strchoice=document.news.choice[i].value;+","
}
}
strchoice=strchoice.substring(0,strchoice.length-1);
document.news.choiceid.value=strchoice;
alert(document.news.choiceall.value);
}
</script>
<html>
...
<form name="news" action="test.php" method="post" onsubmit="check()">
<input type="checkbox" name="choice" value="1">
<input type="checkbox" name="choice" value="2">
<input type="checkbox" name="choice" value="3">
<input type="checkbox" name="choice" value="4">
<input type="hidden" name="choiceid" value="">
</form>
...
</html>