in reply to Re: Drop-down list Option Value
in thread Drop-down list Option Value

In your HTML code you have

<option value="fish1.jp­g">Fresh water fish</option>

Only the contents of the value attribute are sent to your CGI script by the browser. So if you want your script to display "Fresh water fish", then you either need to put that into the value attribute or have some sort of a lookup table/file where you can match fish1.jpg to "Fresh water fish"

On an unrelated note, I am not very sure what cgi-lib.pl is, but you should consider using a standard module for parsing the submitted form data such as CGI. Here's the relavent section of Ovid's web tutorial that talks about why you should use CGi.pm


Just a tongue-tied, twisted, earth-bound misfit. -- Pink Floyd

Replies are listed 'Best First'.
Re: Re: Re: Drop-down list Option Value
by Happyjack (Novice) on Feb 02, 2003 at 21:21 UTC

    Pink Floyd,
    Just a aheads up regarding cgi-lib. The cgi-lib.pl library has become the de facto standard library for creating Common Gateway Interface (CGI) scripts in the Perl language. You can find information on this at Berkeley. I still need to dig into the difference between the two.

      What's your justification for this statement? The self description on the web page? Look at the date on the bottom of the page:
      $Date: 1998/02/20 05:08:40 $

      If you hang around here for very long, it would be pretty clear that CGI is the de facto library for creating cgi scripts.

      As for your question: The only information that is submitted to your cgi program is the value inside the option tag. So you either have to put the desired text in the value attribute, or you have to map the value attributes to some text within the cgi program. Moreover, you probably don't want to have the image names in the value tags; choose a simple alias to place in the value attributes, and then map that value to the appropriate text and file name within the program.

      As TStanley pointed out to me, cgi-lib was designed for Perl4. When Perl5 came out with support for modules, cgi-lib was ported to CGI module.

      So unless you are stuck with Perl4, you should be looking at the CGI module which is now the defacto standard.


      Just a tongue-tied, twisted, earth-bound misfit. -- Pink Floyd