Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 => '', ChkBoxName2 => '', ); 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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://267404]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-06-18 04:04 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.