Branching Method, Page 2
We'll use these a lot in some of the upcoming PERL primers.
It looks like this:
It's the same code as above except there's no MESSAGE filehandle. This is straight text to be printed to the page. Each line is well-formed using the quotes and semicolon at the end. Depending on what the user chooses, this will print the appropriate text to the page. No problem.
OK, here's the deal. You want to add a form select menu with four choices. For the sake of academic argument, you will ask how the user would like something shipped. Can you show the appropriate HTML code and then the appropriate code you'd add to the PERL script? Have the PERL Script post a thanks for each of the shipping choices.
Here's a possible answer.
(This will open a new window):
if ($FORM{newsletter} eq "yes")
{print MESSAGE "We will subscribe you to our newsletter right
away!\n\n"; }
elsif ($FORM{newsletter} eq "no")
{print MESSAGE "You should rethink not signing up for the
newsletter.\n\n"; }
else
{print MESSAGE "Oh, I see, you're too good to answer the
question.\n\n"; } Primer Six Assignment
