September 2, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Branching Method

  • May 6, 2000
  • By Joe Burns
  • Send Email »
  • More Articles »

We'll use these a lot in some of the upcoming PERL primers.

It looks like this:

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"; }  

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.

Primer Six Assignment

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):





Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel