PHP - CheckBoxList

# Form Input:
<form id="myForm" method="post">
<input id="CheckBoxList[]" type="checkbox" name="CheckBoxList[]" 
value="1"/>
<input id="CheckBoxList[]" type="checkbox" name="CheckBoxList[]"
 value="4"checked="checked"/>
<input id="CheckBoxList[]" type="checkbox" name="CheckBoxList[]"
 value="3"checked="checked"/>

<input type="submit" name="ButtonOK" value=" Save "/>
</form>
 
# PHP Action: 

$access_menu_id_array = $_POST["CheckBoxList"];
for($i=0; $i<sizeof($access_menu_id_array); $i++)
{
 $access_menu_id .= $access_menu_id_array[$i];
 if ((i+1) < sizeof($access_menu_id_array))
  $access_menu_id .= ",";
}

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image