CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [ningji] cgi.pm question: difference between param and cookie: Edit Log



FishMonger
Veteran / Moderator

Nov 3, 2012, 6:51 AM


Views: 2135
Re: [ningji] cgi.pm question: difference between param and cookie


In Reply To
it's working, :) Thanks very much !

but this is what i don't understand,


$q->param(-name=>"first_var", -value => $v1);
$q->param(-name=>"second_var", -value => $v2);
}
What do you expect these lines to do? I can assure you that they don't do what you expect and are not needed/wanted. Remove them.


thought these 2 lines are updating the values for "first_var", "second_var".
this is what param( ) for.

is it because these 2 lines are not inside the form block ?


Sounds like you need to read the CGI documentation more carefully.

The param() method is used (almost exclusively) to RETRIEVE the SUBMITTED form field data. It is also overloaded so that you can add/update/set a parameter that is used during this execution of the script but is never used to update a form field that the user sees and sends back for the next invocation of the script.

In your case, you're updating the values of those params, but never use them after that, which makes it pointless.

The hidden form fields are doing what you think those 2 param() statements are doing.


(This post was edited by FishMonger on Nov 3, 2012, 6:52 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Nov 3, 2012, 6:52 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives