Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Passing form data between scripts

by shemp (Deacon)
on Apr 01, 2005 at 00:26 UTC ( #444028=note: print w/ replies, xml ) Need Help??


in reply to Passing form data between scripts

hidden form fields is one way.


Comment on Re: Passing form data between scripts
Re^2: Passing form data between scripts
by b310 (Scribe) on Apr 01, 2005 at 01:25 UTC
    Hi,

    How do I accomplish using hidden form fields?

    Do I define the hidden fields in the first form which passes to the first script (camp.cgi)?

    Thanks for your help.
      In one page, inside a form, you can have a hidden field of the form <input type="hidden" name="thing" value="$thing"> and the script invoked by the form then gets the value by using param (using CGI.pm, of course), i.e. $thing=param('thing') You can use CGI.pm to produce the code for the hidden field using something like print hidden(-name=>"thing1",-value=>"thing2"); but I seem to recall having difficulty getting variables to interpolate in the value, so I've usually used the explicit first way. (If someone can comment on the interpolation problem, I'd be happy to hear about that...) The CGI module has built-in handling of "stickiness" (i.e. maintaining state (and I believe this makes use of hidden fields in a clever way... I don't understand it very well)) but it usually takes me such a lot of messing around to get it to work properly that I mostly just use hidden fields myself. That's not meant to detract from CGI.pm at all - it is a wonderful tool, I just don't know it well enough. (I always use CGI.pm, I just don't always use all of the subtleties available.)
      chas
        Hi,

        Thanks for the reply. I think I see where you're going with this. I just want to clarify something.

        The form that is being sumbitted is an HTML form. One of the fields is name. From articles I read about HTML and hidden fields, when I type the following line:
        <input type="hidden" name="member" value="hard coded value">

        The "value" parameter in the articles are setting a hard coded value to each name="member". In this case, the value for name or member is going to be different for every person who completes the form.

        How do I write my hidden field in the form so it doesn't pass hard coded values instead it will pass the actual info entered by the person completing the form? I guess what I'm asking is how do I set a value for "member" that is global? I think?.

        Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-11-21 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (104 votes), past polls