|
Posted by Steve on 11/06/06 19:30
<schwooba@gmail.com> wrote in message
news:1162833773.916606.150670@e3g2000cwe.googlegroups.com...
| Hello...I have a form with checkboxes on it. When those check boxes are
| selected, I want them to email those selected individuals. I think I
| have to create an array but I can't quite figure it out. Any help would
| be appriciated.
|
| <input type="checkbox" name="email[]" value="1"> email john doe
| <input type="checkbox" name="email[]" value="2"> email jane doe
| <input type="checkbox" name="email[]" value="3"> email play doe
if values 1, 2, and 3 were the id's of records that contained valid email
addresses, you would just do something like:
$email = $_REQUEST['email'];
if (!is_array($email)){ $email = array(); }
$sql = "
SELECT emailAddress
FROM people
WHERE id IN
(
" . implode(', \n', array_values($email)) . "
)
";
$records = db::execute($sql); // whatever your db interface demands;
foreach ($records as $record)
{
echo '<pre>' . $record['EMAILADDRESS'] . '</pre>';
// or whatever you intend to do with the address at this point
}
hth,
me
Navigation:
[Reply to this message]
|