develooper Front page | perl.beginners | Postings from February 2002

Re: LISTBOX Problem

Thread Previous | Thread Next
From:
Octavian Rasnita
Date:
February 6, 2002 18:30
Subject:
Re: LISTBOX Problem
Message ID:
002a01c1afd3$40a240a0$1a65e9d5@ion
Can you select the items in the list with the keyboard?
Or the OnChange is triggered automaticly when you use the arrow keys?

Teddy,
My dear email address is orasnita@yahoo.com

----- Original Message -----
From: "Mike" <mtpratt1971@hotmail.com>
To: <beginners@perl.org>
Sent: Wednesday, February 06, 2002 6:28 AM
Subject: LISTBOX Problem


I am trying to populate a list box in a form with using the following
script and it works fine doing it this way:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE> Current Weather Products</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
#print "<select name=\"select\">\n";
print "<form name=\"form\">\n";
print "<select name=\"radar\"
onChange=\"window.location=document.form.radar.options[document.form.radar.s
electedIndex].value\">\n";

print "<option value=\"\">Zone Forecasts</option>\n";
chdir("/var/www/html/members/wx/zfp/") || die "Cannot chdir to
/var/www/html/members/wx/zfp/ ($!)";
while (<*>) {
        print "<option
value=\"http://www.myserver.com/members/wx/zfp/$_\">$_</option> \n";
        }
</select>\n
</BODY>\n
</HTML>\n
END


Here is the problem. If I change it to this:


#!/usr/bin/perl
print "Content-type: text/html\n\n";

print<<END
<HTML><HEAD>
<TITLE> Current Weather Products</TITLE>
</HEAD>
<BODY>
<form name=\"form\">
<select name=\"radar\"
onChange=\"window.location=document.form.radar.options[document.form.radar.s
electedIndex].value\">

<option value=\"\">Zone Forecasts</option>
END

chdir("/var/www/html/members/wx/zfp/") || die "Cannot chdir to
/var/www/html/members/wx/zfp/ ($!)";
while (<*>) {
        print "<option
value=\"http://www.myserver.com/members/wx/zfp/$_\">$_</option> \n";
        }

print<<END
</select>\n
</BODY>\n
</HTML>\n
END

It errors out Can someone help me with this?

syntax error at ./listfiles.pl line 13, near "chdir"
  (Might be a runaway multi-line << string starting on line 4)
BEGIN not safe after errors--compilation aborted at ./listfiles.pl line
14.


Thanks Mike



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About