Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: multiple values and CGI.pm

by modred (Pilgrim)
on Mar 22, 2001 at 17:58 UTC ( #66329=note: print w/replies, xml ) Need Help??


in reply to multiple values and CGI.pm

The problem you are having may be with the call to textfield('name').

When you use CGI.pm's functions to print out form elements they exhibit a certain stickiness. That is, if you already have elements that have been passed in as parameters to the script then CGI.pm will, by default, print out the passed in value. If you want to give it another value than the one that was originally passed in, you need to either pass it an explicit value and the -override=>1 argument or use something like $query->param('foo',"I'm taking over this value!");.

Both of the above methods are described under the section "Creating a Text Field" in the text obtained by doing a perldoc CGI.

So, in your above example, you are making two calls to textfield('name'). Textfield appears to only take a scalar argument, so only the first element of the array is used in both cases. CGI.pm does not remember if it has printed the element before or not.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://66329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2023-06-10 04:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (36 votes). Check out past polls.

    Notices?