Forms, Perl. Data in the <select> tag disappears after submit.

In the following code, the data in the second set of <select> tag disappears after I click on the submit button. How can I stop tha browser from doing that?

#!/usr/bin/perl

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
print header, start_html;

#Get option of select
$SelectedValue=param('sel0') or "";

#Open servers' list
open(DAT, "<ServerList.txt") or die "<ServerList.txt $!";

@eek=<DAT>;
print "<table border=1><tr>";
print "<td>";
print "<form action=some.pl method=post>";
print "<select size=10 id=a name=sel0>";
foreach(@eek)
{
print "<option>";
print;
}
print "</select>";
print "<input type=submit id=gv>";
print "</form>";
print $SelectedValue;

print "</td>";
print "<td>";

$thing="cleartool lsvob -s -host ";
if ($SelectedValue eq ""){
#$thing="";
}
else{
$thing=$thing . $SelectedValue;

@aak=`$thing`;

open (DUT, ">ee.txt") or die ">ee.txt $!";
foreach $pu (@aak){
print DUT "$pu";
}
close DUT;

open (DUT, "<ee.txt") or die "<ee.txt $!";
@aok = <DUT>;
close DUT;
}

print "<form action=some.pl method=post>";
print "<select size=10 id=a name=sel1>";
foreach (@aok)
{
print "<option>";
print;
}
print "</select>";
print "<input type=submit id=gv1>";
print "</form>";
$SelectedValue1=param('sel1') or "";
print $SelectedValue1;
print "</td>";
print "<td>";

$thing1="cleartool lstype -short -kind trtype -invob vob:";
if ($SelectedValue1 eq ""){
#$thing1="";
}
else{
$thing1=$thing1 . $SelectedValue1;

@ook=`$thing1`;

}
print "<form action=some.pl method=post>";
print "<select size=10 id=a name=sel2>";
foreach(@ook)
{
print "<option>";
print;
}
print "</select>";
print "<input type=submit id=gv2>";
print "</form>";
$SelectedValue2=param('sel2') or "";
print $SelectedValue2;




print end_html;


n4narikAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

geotigerCommented:
It seems that the select in the second form depends on the command in '$thing'. If it is empty, you will get empty select.

The $thing is executed only if you have something selected in sel0 parameter. Check the value in $SelectedValue.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ozoCommented:
$SelectedValue1=param('sel1') or "";

$thing1=$thing1 . $SelectedValue1;

@ook=`$thing1`;

can be very dangerous
What if a user sends something like param('sel1') = '; rm -r *'
0
n4narikAuthor Commented:
I would like to close this question as I didn't get satisfactory results from the users.
Help me admin.
0
ozoCommented:
What do you find unsatisfactory?
Perhaps you need to clarify your question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.