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]
[stevieb]: Torturing one of my dev RPis to turn four 5v stepper motors at the same time (via Parallel:: ForkManager for 50k degrees (a whole lot of full turns!). Let's see if it burns out or not.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-03-22 22:14 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (286 votes). Check out past polls.