Easy there fellah, don't blow a gasket. I'm not arrogant with my perl knowledge, I use Perl monks for help a lot more than I use it to provide answers.

However, having said that, your original post looked a lot like a high schooler looking for an easy answer for a programming assignment. If such is not the case, then it's all well and good.

You want to use the CGI module to take the input from your html form. First step would be to point your html form to your perl script.. something like:

<FORM METHOD="POST" ACTION="/cgi-bin/button.cgi">

Then in your perl script you need to create a new cgi object, like so:

use strict; use Mail::Sendmail; use CGI; my $cgi = new CGI;
Then get the value of the button that was checked.
my $button_value = $cgi->param('m_EmailGroups');
Then you'll need to do whatever comparison you need to do on the $button_value variable, and then send the email:
my %mail = ( To => 'myhomeaddress@isp.com', From => 'myworkaddress@company.com', Subject => 'Form Submission', Message => "The $button_value button was checked." ); sendmail(%mail) or die $Mail::Sendmail::error;
All code is untested and offered as a guide. Take it, read it, learn it, change it, use it.

In reply to Re: Re: Re: sending email based on form checkbox selection by erasei
in thread sending email based on form checkbox selection 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.