> > You shouldn't use quotes - instead use apostrophe's, there is
> > probably a
> > reason why, but I can't remember.
>
> That's because there is no reason. The double quotes are fine,
> and are not related to the problem in any way.

OK. It's probably because every example I've seen uses apostrophes.

> > Also, you can't use a
> > -LABELS part. Read
> > the CGI.pm docs to see what you can use with functions.
>
> Sure you can. Either you need to read the docs, or you need to
> upgrade your CGI module.

Thanks for pointing that out. I've got Lincoln Stein's book, but there isn't 
an example of popup_menu using labels, only radio_group. It is mentioned 
(upon closer inspection) in the same paragraph as radio_group, and in the 
reference guide near the end of the book.

> > Your code should look like this:
> >
> > ...
> > print popup_menu(
> >             -name=>'baths',
> >             -value=>['0', '1', '1 1/2', '2']
> >             -default=>'1'
> > );
>
> Only if he dosen't want it to work. Did you actually run this?
> If you did, you would have seen the warning, since you had the
> -w flag set. You make the same mistake the original poster did:
> omitting the comma before "-default".

Here's the code I ran:

#!/usr/bin/perl -w

use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;

my $x = '1 1/2';

print header, start_html("CGI Test");
print start_form();
print popup_menu(
                -name=>'baths',
                -values=>['0', '1', '1 1/2', '2'],
                -default=>$x
);
print end_form();
print end_html;

I get a perfect result through Netscape. Here's the HTML:

<SELECT NAME="baths">
<OPTION  VALUE="0">0
<OPTION  VALUE="1">1
<OPTION SELECTED VALUE="1 1/2">1 1/2
<OPTION  VALUE="2">2
</SELECT>

> Here's the output I got when I ran that code:
>
>    <select name="baths" 1>
>    <option  value="1073866360">1073866360</option>
>    </select>
>
> Hey, everybody makes mistakes. But take the time to actually
> run the code you post.

Of course I ran it before posting. I said I wasn't a pro, but I wouldn't 
have posted if my code didn't work.

Gerry.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to