in reply to Re: Display (print) selected value
in thread Display (print) selected value

Allthough I would suggest to remove some redundancy in the code to make it a bit more readable:
print qq|<form action="test.cgi" method="post">\n|, qq|<center><select name="selected" size="1">\n|; foreach ($item1, $item2, $item3, $item4, $item5) { my $selected_flag = $input{selected} eq $_ ? "selected" : ""; print qq|<option value="$_" $selected_flag> $_ </option>\n|; } print qq|<INPUT type="submit" name="submit" value="Select"\n|, qq|</form><p><br>\n|, qq|</select>\n|;
Of course, I'd like also recommend to use the CGI module.

Greetings,
Janek