Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: CGI / Perl form to email from input field.

by dash2 (Hermit)
on Jun 20, 2003 at 00:19 UTC ( #267404=note: print w/ replies, xml ) Need Help??


in reply to CGI / Perl form to email from input field.

The normal way to get data from HTML forms is to use the standard CGI module.

use CGI 'param'; # use the CGI module, and import the function named " +param" $email_to = param('extra_emails'); # this assumes that your text input + is called "extra_emails"

For simplicity, you could use the "param" method for your checkboxes too. Don't do all those ifs though. Use a hash, it's simpler:

my %checkboxes = ( ChkBoxName1 => 'EmailGroup1@Domain.com', ChkBoxName2 => 'EmailGroup2@Domain.com', ); foreach my $checkbox_name (keys %checkboxes) { $email_to .= "$checkboxes{$checkbox_name}, " if param($checkbox_name +); # if the checkbox was ticked, the param call returns true, and $em +ail_to gets the email address added. }

Now I've given you some useful code. That was nice of me, wasn't it? In return, could you do me a favour? Follow the previous poster's advice. Go read Ovid's course on CGI and the other links he sent you. Learn what you are doing. It will save you time and heartache, and it will make your job more interesting and creative.

andramoiennepemousapolutropon


Comment on Re: CGI / Perl form to email from input field.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://267404]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-08-27 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (252 votes), past polls