Works fine for me. Note that, since CGI's form fields are sticky, you don't even need to set the default value. It will just pick up the current value(s) for the 'country' parameter anyway.
If you really want to change the a form field's initial values, the docs for CGI explain how:
Another note The default values that you specify for the
forms are only used the first time the script is invoked
(when there is no query string). On subsequent
invocations of the script (when there is a query string),
the former values are used even if they are blank.
If you want to change the value of a field from its
previous value, you have two choices:
(1) call the param() method to set it.
(2) use the -override (alias -force) parameter (a new
feature in version 2.15). This forces the default value
to be used, regardless of the previous value:
print $query->textfield(-name=>'field_name',
-default=>'starting value',
-override=>1,
-size=>50,
-maxlength=>80);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.