Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://267404]
help
Chatterbox?
Discipulus shall be damned all progs that do not provide different font size!
[Corion]: Yeah - that's one important thing why I like to run my presentations from my browser. Ctrl+ and Ctrl- are incredibly helpful there to make sure everybody can read stuff

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2017-09-26 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (293 votes). Check out past polls.

    Notices?