You are here: Re: Email to checked boxes « All PHP « IT news, forums, messages
Re: Email to checked boxes

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация