
Originally Posted by
freecrm
I'm not sure what you're getting at with filtering the $_POST['checkbox'].
Filtering means removing/cleaning up invalid data from input, usually with the filter functions. It's related to validation and very important in preventing SQL injection.

Originally Posted by
freecrm
All the script does is (as you've suggested) create a for loop over the $send_array and check if it returns a value.
Actually, your script loops over an index. If you use a foreach loop, you can loop over the array elements directly:
PHP Code:
foreach ($send_array as $contactID) {
$query_sendlist ="SELECT CONTID, COMPANY, FIRSTNAME, LASTNAME, DEAR, POSITION, EMAIL FROM CONTACTS WHERE CONTID='$contactID'";
...
}

Originally Posted by
freecrm
In this way, if the checkbox is checked, it pulls the ID from the $row_recordset and creates a new query, from which it then sends the mail address from that row
If the checkbox isn't checked (and the array does not return a value) it simply skips the mail coding.
If a checkbox isn't checked, the browser won't send a value for that form control. For example, if you send the following form:
HTML Code:
<form>
<input name="contactID[]" type="checkbox" value="foo" checked />
<input name="contactID[]" type="checkbox" value="bar" checked />
<input name="contactID[]" type="checkbox" value="bam"/>
<input name="contactID[]" type="checkbox" value="bug-AWWK!" />
</form>
you'll get the URL encoded string "contactID[]=foo&contactID[]=bar", which PHP will translate to "array('foo', 'bar')" and store it in $_REQUEST['contactID']. You should check for empty values only if your filter function doesn't remove them. The better approach would be to consider empty values as invalid so that they'll be removed when you filter out invalid input.
Edit: Did you check if register_globals is enabled on your work server?