With JS
Function recheck (form)
{
VaR temp = Document. getelementbyid ("categories ");
Temp. value = (temp. value. substring (0, 1) = ",")? Temp. value. substring (1, temp. value. Length): temp. value;
Return true;
}
Function CK (o)
{
VaR v = O. value;
VaR temp = Document. getelementbyid ("categories ");
Temp. value = (O. Checked )? Temp. Value + "," + V: temp. value. Replace ("," + V ,"");
}
<Form method = "Post" enctype = "multipart/form-Data" name = "form1" onsubmit = "Return recheck (this)">
<Input type = "hidden" name = "categories" id = "categories"/>
<Input type = "checkbox" name = "category" id = "category" value = "1" onclick = "CK (this)"/>
<Input type = "checkbox" name = "category" id = "category" value = "2" onclick = "CK (this)"/>
<Input type = "checkbox" name = "category" id = "category" value = "3" onclick = "CK (this)"/>
</Form>
This is only when the data size is small, because the length of hidden is limited.