Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to pass more parameters to a CGI program than inputs in an HTML page?

by Anonymous Monk
on Feb 22, 2001 at 04:08 UTC ( [id://60092]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to pass more name/value parameters to a CGI program than I have inputs for in an HTML form. Anyone have a suggestion about how to do this?
  • Comment on How to pass more parameters to a CGI program than inputs in an HTML page?

Replies are listed 'Best First'.
Re: How to pass more parameters to a CGI program than inputs in an HTML page?
by rfb (Sexton) on Feb 22, 2001 at 04:32 UTC
    mabey you mean a hidden field? like
    <input type="hidden" name="bla" value="mm hmm">
    or
    print hidden(-name=>'bla', -value=>'mm hmm');
    if your using CGI.pm
Re: How to pass more parameters to a CGI program than inputs in an HTML page?
by Maclir (Curate) on Feb 22, 2001 at 06:28 UTC
    Well, by definition, the only way a sgi program can receive parameters is via a fields within a pair of <FORM> </FORM> tags. These are coded as INPUT, SELECT or TEXTAREA fields. Now, if what you are wanting is to have some values that you set on the form, but the user cannot see and (normally) change, then you can use hidden fields:
    <FORM ACTION="/cgi-bin/formprocess.perl" METHOD="post"> <INPUT TYPE="hidden" NAME="formtype" VALUE="testform"> . . . . </FORM>
    Now along with other parameters that CGI.pm will retreive, there will be a parameter "formtype" with a value of "testform".
      That's not quite correct. You can pass extra parameters, but you'll need to use the URL, and will have to do some extra processing by hand. For example, arrange to post a form to http://www.example.comx/foo.cgi/extra/params/here The parameters (along with the CGI name) will be available to the script in $ENV{PATH_INFO}.

      This trick works on both Apache and IIS.

        Just the same, you could add an extra arg on the end of the cgi request:
        http://www.example.com/foo.cgi?param1=foo&param2=bar&extrasneakyextrap +aram=foobar
        This assumes that the cgi does no sanity checking on args it recieves.

        BlueLines

        Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-16 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found