I'm trying to make a email form where the sender can select his/her recipients by checking them. Here is my form code that diplays the recipients and checkboxes: <input type="checkbox" name="email[]" value="recipient 1" /> Recipient 1 <input type="checkbox" name="email[]" value="recipient 2" /> Recipient 2 And this is the php code: $recipient[] = "mail1@somewhere.com"; $recipient[] = "mail2@somewhere.com"; $mailto=""; foreach(array_intersect(array_keys($recipient),array_values($_POST['email'])) as $val) { $mailto.=$recipient[$val].','; } $mailto=trim($mailto,','); I keep getting these error messages: Warning: array_values(): The argument should be an array Warning: array_intersect(): Argument #2 is not an array Warning: Invalid argument supplied for foreach() And in addition the script displays a "not a valid email" error message, but this is caused by the array error. Please help!