Hi, I'm writing a script and I'm having some problems with retrieving checkbox values, say for example I have for checkbox's values are 1, 2, 3, 4 respectively eg. 1 2 3 4 What I need it do is when the user checks for example 1 and 2 how do I make $check = 1,2 and so fourth. $check = 1,2; Code (markup): Any help would be greatly appreciated, thanks a lot.
put a name attribute to the input tags like: and $fields = $_POST['fields']; will save the selected values in an array; You may need some functions dealing with arrays like print_r; foreach; the html <pre> tag is also useful.
as Martin Said make the name of the checkbox field as and array "fields[]" then in the page that process the form use the following