1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <form action="index.php" method="post"> <input type="checkbox" name="category_list[]" value="1">Category 1 <input type="checkbox" name="category_list[]" value="2">Category 2 <input type="checkbox" name="category_list[]" value="3">Category 3 <input type="checkbox" name="category_list[]" value="4">Category 4 <input type="checkbox" name="category_list[]" value="5">Category 5 <input type="submit" value="Add" /> </form> <?php if(isset($_POST['category_list'])) { $category_list = array(); foreach($_POST['category_list'] as $val) { $category_list[] = (int) $val; } $category_list = implode(',', $category_list); echo "Categories are :- ".''.$category_list; exit; } ?> |