Sponsored Content
Top Forums Shell Programming and Scripting CGI passing arrays/hashes to another CGI script Post 33628 by cbkihong on Monday 13th of January 2003 10:22:11 AM
Old 01-13-2003
Hmm. Or you can better do it this way:

You can have script1 generate HTML containing a form (POST HTTP-method) with all your items specified by hidden fields, i.e. generate something like

<form action="script2.cgi" method="post">

<!-- Hidden fields -->
<input type="hidden" name="item0" value="value0">
<input type="hidden" name="item1" value="value1">
<!-- hidden fields end here-->

<input type="submit" value="submit">
</form>

When the visitor hits the submit button, the hidden fields are sent and by reading the form you can parse and get the (item0, value0), (item1, value1) pairs.

If you insist on a hyperlink, then the only method you can pass the info to script2 is by HTTP GET, i.e. on the URL as params. Script1 generates HTML containing a link with href "script2.cgi?item0&amp;item1&amp;..."

Your script then parses the env. variable $ENV{'QUERY_STRING'} and gets all key-value pairs to form the array again.

You will first need to convert the special characters in the array items (say @) into the % form (i.e. %40) in order to form a valid URL.

All such item mangling should be easy if you use CGI.pm.

Of course I prefer the POST method, as the URL is less noisy, and this is the method I use, right now.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX CGI script

Hey everyone! I hope someone here is good with Unix CGI scripts. I'm having trouble with my CGI. Here's the deal I've created a program that searches the passwd file and cuts the users real name when it's given the login name. When i converted it to CGI i ran into some problems: 1) when you... (3 Replies)
Discussion started by: primal
3 Replies

2. OS X (Apple)

cgi script

Hello, we have an extranet where every user has a password and a username. Some powerusers must have the possibility to access data of all the users without knowing their password. The powerusers must know the username. We want to use a form for this where a poweruser just gives the username. Then... (0 Replies)
Discussion started by: Vincent
0 Replies

3. Shell Programming and Scripting

CGI script to sql db

I am not sure if you can help - but I am desparate so I will ask anyway. I have a solaris server which I am running apache and mysql db on. I have a basic web page (internal to my lan only) I know some shell scripting (ksh etc) and I can create a very basic cgi script using shell scripting. ... (1 Reply)
Discussion started by: frustrated1
1 Replies

4. Shell Programming and Scripting

cgi script question

Hi All, I have a web page that is a cgi script running in the cgi-bin and the script calls informatica via the command line. The problem I have is that if there is an error in the informatica workflow then exit status of my command line call does not get populated and it seems like the page is... (1 Reply)
Discussion started by: zilla30066
1 Replies

5. Solaris

apache ErrorDocument 400 /cgi-bin/400.cgi

Hi All, Sorry if the question is trivial for you but, I am new to Apache (2.0.63) and am trying to figure out how to display my 400.cgi. Here is what I have in httpd.conf servername testing DocumentRoot "/usr/local/apache2/htdocs" ErrorDocument 400 /cgi-bin/badrequest-400.cgi Here is... (0 Replies)
Discussion started by: afadaghi
0 Replies

6. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

7. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

8. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

9. Shell Programming and Scripting

Help need in CGI script

Hello All, first of all please forgive me if I have brocken some rule of this forum and this is not a homework :). Could you please help me as I have created a new apache service in a server by creating a new httpd.conf for the new service. Now in the httpd.conf file I have studied by... (3 Replies)
Discussion started by: RavinderSingh13
3 Replies

10. Shell Programming and Scripting

Cgi script please help!

ok so for the project i had to log in amazon node to submitted and create a captcha using cgi scripts its for a unix project this is my amazon node address ss. but first i have to create a .ht access to set the master password. can someone please help me??? in public_html, create a file... (1 Reply)
Discussion started by: jr44
1 Replies
CGI::Compile(3pm)					User Contributed Perl Documentation					 CGI::Compile(3pm)

NAME
CGI::Compile - Compile .cgi scripts to a code reference like ModPerl::Registry SYNOPSIS
use CGI::Compile; my $sub = CGI::Compile->compile("/path/to/script.cgi"); DESCRIPTION
CGI::Compile is an utility to compile CGI scripts into a code reference that can run many times on its own namespace, as long as the script is ready to run on a persistent environment. NOTE: for best results, load CGI::Compile before any modules used by your CGIs. RUN ON PSGI
Combined with CGI::Emulate::PSGI, your CGI script can be turned into a persistent PSGI application like: use CGI::Emulate::PSGI; use CGI::Compile; my $cgi_script = "/path/to/foo.cgi"; my $sub = CGI::Compile->compile($cgi_script); my $app = CGI::Emulate::PSGI->handler($sub); # $app is a PSGI application CAVEATS
If your CGI script has a subroutine that references the lexical scope variable outside the subroutine, you'll see warnings such as: Variable "$q" is not available at ... Variable "$counter" will not stay shared at ... This is due to the way this module compiles the whole script into a big "sub". To solve this, you have to update your code to pass around the lexical variables, or replace "my" with "our". See also <http://perl.apache.org/docs/1.0/guide/porting.html#The_First_Mystery> for more details. AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net> CONTRIBUTORS
Rafael Kitover <rkitover@cpan.org> Hans Dieter Pearcey <hdp@cpan.org> COPYRIGHT &; LICENSE Copyright (c) 2009 Tatsuhiko Miyagawa <miyagawa@bulknews.net> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
ModPerl::RegistryCooker CGI::Emulate::PSGI perl v5.14.2 2011-05-24 CGI::Compile(3pm)
All times are GMT -4. The time now is 06:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy