Reply to Re: Using Formmail.php and trying to select multiple recipients

Your name:

Reply:


Posted by Daniel Tryba on 05/21/05 04:20

Geoff Berrow <blthecat@ckdog.co.uk> wrote:
>><input type="checkbox" name="email1" value="recipient1" />Recipient 1
>><input type="checkbox" name="email2" value="recipient2" />Recipient 2
>><input type="checkbox" name="email3" value="recipient3" />Recipient 3
>>
>>where "recipient[n]" is stored in the script:
>>
>>"recipient1" = "email1@email.com"
>>"recipient2" = "email2@email.com"
>>"recipient3" = "email3@email.com"
>
> Give the checkboxes the same name
> <input type="checkbox" name="email[]" value="recipient1" />Recipient 1
> <input type="checkbox" name="email[]" value="recipient2" />Recipient 2
> <input type="checkbox" name="email[]" value="recipient3" />Recipient 3
>
> then
>
> $mailto=implode(",",$_POST['email'] );

Close but not complete since $_POST['email'] doesn't (and certainly
shouldn't) contain the emailadresses.

To compare the _values_ of $_POST['email'] with the _keys_ in
$recipient:

<input type="checkbox" name="email[]" value="0" />Recipient 0
....
<input type="checkbox" name="email[]" value="N" />Recipient N

$recipient[]="email1@example.com"
....
$recipient[]="emailn@example.com"

$mailto="";
foreach(array_intersect(array_keys($recipient),array_values($_POST['email']))
as $val)
{
$mailto.=$recipient[$val].',';
}
$mailto=trim($mailto,',');

[Back to original 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

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