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

Does anyone have an idea of how exactly I'd do this? I want to be able to have links point to something like "index.cgi?page=edit;cont=content", where 'content' is actually the name of a stored page to edit...but I have no idea how exactly to get this to work. Does anyone have any ideas?

Thanks,
Spidy
  • Comment on Passing multiple parameters to a CGI script?

Replies are listed 'Best First'.
Re: Passing multiple parameters to a CGI script?
by bassplayer (Monsignor) on Sep 14, 2005 at 21:15 UTC

    You'd be wanting to change your link from index.cgi?page=edit;cont=content to index.cgi?page=edit&cont=content since the ampersand(&) is the delimiter you are looking for.

    As far as doing something with the parameters in your script, I recommend Ovid's CGI course.

    Update: Per InfiniteSilence's reply below, you can keep your parameters delimited by semi-colon(;). (Thanks, IS, for the new knowledge!) If you are still unsure as to how to proceed after reading chas's reply and consulting Ovid's CGI course, you might post more of the code you've tried, which is much more likely to elicit specific assistance.

    bassplayer

      You are not required to use ampersands to delimit variables if your script is using the CGI module. From the CGI perldoc:

      -newstyle_urls Separate the name=value pairs in CGI parameter query strings w +ith semicolons rather than ampersands. For example: ?name=fred;age=24;favorite_color=3 Semicolon-delimited query strings are always accepted, but wil +l not be emitted by self_url() and query_string() unless the -newstyle_urls pragma is specified. This became the default in version 2.64.

      Celebrate Intellectual Diversity

        I'm using the standard functions of CGI (use CGI qw(:standard);), and attempting to use
        $queryvariable = new CGI; $variable=$queryvariable->param('param');
        to get the parameters. How would I link to the cgi file, and be able to use multiple parameters?