modifying Re: CGI/PERL email form that will send to multiple address based on checkbox selection (lnl's) style you could do this:
$in{'form-to'} .= $in{'inputf1'} if $in{'inputf1'};
before the fisrt if($in{'ChkboxName1'}){ or if you ended up using chromatic's code you could do this:
my @mail_groups = $q->param( 'mailgroup' ); my %group_addresses = ( group1 => 'group1@domain.com', group2 => 'group2@domain.com', group3 => 'group3@domain.com', ); my @mail_addresses = @group_addresses{ @mail_groups }; push @mail_addesses, $q->param('inputf-emailaddr') if $q->param('inpu +tf-emailaddr'); my $to = join(', ', grep { defined } @mail_addresses );
LOL I can guess what the next question is too: Hello All, I have created a web form that uses CGI to process/format the data to send in the background. Now that I have written the code to collect the email addresses to email to I need to figure out what to do to send the emails... see code below:
$in{'form-to'} .= $in{'inputf1'} if $in{'inputf1'}; if($in{'ChkboxName1'}){ $in{'form-to'} .= ',EmailGroup1@Domain.com'; } if($in{'ChkboxName1'}){ $in{'form-to'} .= ',EmailGroup2@Domain.com'; } if($in{'ChkboxName1'}){ $in{'form-to'} .= ',EmailGroup3@Domain.com'; } $in{'form-to'} =~ s/^,//;
=))

-Waswas

In reply to Re: CGI / Perl form to email from input field. by waswas-fng
in thread CGI / Perl form to email from input field. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.