Processing Form

Hey guys, I have used php to create a table with checkbox’s for the user to check which staff they want to work.
I’m kinda lost as to how I go about processing only checkbox’s.

So the value of a checked box is ‘on’
The value of an unchecked box is ‘’

Each staff member has a box beside their name.
When submit is pushed it sends

Which if checked sends $_POST[‘personsname’] as a value off ‘on’, or ‘’
How do I then process this to change a value for that person in the database, to use, or not to use with out writing down all their names.

Ignore onclick

So it stores their name in fields[array]

How do I process it?

$_POST['fields] outputs array

I have also tried

[php]if (count($fields) > 0) {
for ($i=0;$i<count($message);$i++) {
$id = $message[$i];
echo $id;
}
} [/php]

Returns nothing

Your array of checkboxes named ‘fields’, but what this means in your code: count($message) ?

[php]if(is_array($_POST[‘fields’])) foreach($_POST[‘fields’] as $value){
echo $value;
}[/php]

Was trying different ideas and forgot to set all them all the same before post here :confused:
[php]if(is_array($_POST[‘fields’])) foreach($_POST[‘fields’] as $value){
echo $value;
}[/php]

Works a treat, thankyou very much.

Sponsor our Newsletter | Privacy Policy | Terms of Service