deadlock Message Board
[ November Full List | Reply ]

Re: Programming question Part II
From Jim on 15 November '98
replying to Programming question Part II posted by Bradley

NOTE TO REGULAR BOARDERS: See below - you can now post
HTML tags! (Do I hear sighs of reief?)

<INPUT TYPE="checkbox" NAME="Lollipops" VALUE="Yes"> Lollipops
<INPUT TYPE="checkbox" NAME="Candy" VALUE="Yes"> Candy bar
<INPUT TYPE="checkbox" NAME="Popcorn" VALUE="Yes"> Popcorn

>When a person clicks on a checkbox, I want to have their
>information emailed to five different email addresses....

>I was told the other day that I am going to need an IF statement??

The IF statement would appear within a CGI script. Whoever gave
you the above answer would be presuming you already have experience
of writing scripts. Not HTML.

~~~~~~~~~~~~

(PARSE FORM ETC.)

@lollipops = ("email1","email2","email3");
@candy = ("email1","email2","email3");
@popcorn = ("email1","email2","email3");


if ($FORM{'Lollipops'} eq "Yes") {
foreach $lolli_email (@lollipops) {
open (MAILOLLI,"|/usr/lib/sendmail -t");
print MAILOLLI "To: $lolli_email\n";
&rest_of_lolli;
close (MAILOLLI);
}
}
if ($FORM{'Candy'} eq "Yes") {
foreach $candy_email (@candy) {
open (MAILCANDY,"|/usr/lib/sendmail -t");
print MAILCANDY "To: $candy_email\n";
&rest_of_candy;
close (MAILCANDY);
}
}
if ($FORM{'Popcorn'} eq "Yes") {
foreach $popcorn_email (@popcorn) {
open (MAILPOPCORN,"|/usr/lib/sendmail -t");
print MAILPOPCORN "To: $popcorn_email\n";
&rest_of_popcorn;
close (MAILPOPCORN);
}
}

sub rest_of_lolli {

print MAILOLLI "From: Bradley <bradley\@somewhere.com>\n";
print MAILOLLI "Subject: Lollipop Info\n\n";
print MAILOLLI "Some pointless info on lollipops...\n";

}

sub rest_of_candy {

print MAILCANDY "From: Bradley <bradley\@somewhere.com>\n";
print MAILCANDY "Subject: Candy Info\n\n";
print MAILCANDY "Some pointless info on candy...\n";

}

sub rest_of_popcorn {

print MAILPOPCORN "From: Bradley <bradley\@somewhere.com>\n";
print MAILPOPCORN "Subject: Popcorn Info\n\n";
print MAILPOPCORN "Some pointless info on popcorn...\n";

}

exit;


Replies from other people:


Reply to this message

Required Details
Your name:
Subject:

Optional Details
Home page title:
Home page URL:
Email:
(if you'd like to receive
automatic replies by email)

Your Message