Ask a Question related to PERL Miscellaneous, Design and Development.
-
shade #1
Passing Array Via CGI.pm
Hello all,
I'm a Perl newbie here and have a quick question regarding CGI.pm.
I have a CGI script that passes an array to another CGI script as
follows:
# sender.cgi
.... (snipped code)
my @fruit = ('apple','orange','pear');
print $q->startform( -action=>'receiver.cgi' ),
$q->submit( -name=>'Export Data' ),
$q->hidden( -name=>'xlfruit' value='@fruit' ),
$q->endform;
.... (snipped code)
# receiver.cgi
.... (snipped code)
my @fruit = param( 'xlfruit' );
print @fruit\n;
print @fruit[0]\n;
.... (snipped code)
The values of the fruit array pass through okay to the new CGI script
but come as a single list. I.e. the out of print @fruit[0] is the
whole line (apple orange pear) rather than just apple. It doesn't
look like the variable is still an array after the pass. Is this
normal or am I missing something?
Thanks for any help.
Tom
shade Guest
-
Passing value to Array
If I've got x = "test5" How can I put the value of x to Array list=; I'd try to use ---> list= but is not work. -
passing array in the url
Hello there, I am unable to pass an array thought he url. Even the most simple array as in the code: $test = array(1,2,3,4); echo "<a... -
Array passing problem...
Hoping someone can point out my more than likely simple mistake here... function getBranchArray($desig,$branchArray){ $arrayResult =... -
passing an array
Hello, what is the best way to pass an array to a sub routine, IE. my @fields = qw(one two three); send_array(@fields); -
Passing a keyed Array via php.
Hi ACteon! On 18 Aug 2003 19:17:23 -0700, acteon@yahoo.com (Acteon) wrote: Use - form method="post" - $_POST etc. - no books as they are... -
Tina Mueller #2
Re: Passing Array Via CGI.pm
shade wrote:
the value should be '@fruit'? i'm sure you don't want that.> # sender.cgi
> ... (snipped code)
> my @fruit = ('apple','orange','pear');
> print $q->startform( -action=>'receiver.cgi' ),
> $q->submit( -name=>'Export Data' ),
> $q->hidden( -name=>'xlfruit' value='@fruit' ),
i guess you want several hidden fields with the name 'xlfruit'.
(you also forgot the comma and wrote = instead of => )
try:
map { $q->hidden( -name => 'xlfruit', value => $_ )} @fruit,
then this:
will work.> my @fruit = param( 'xlfruit' );
hth, tina
--
[url]http://www.tinita.de/[/url] \ enter__| |__the___ _ _ ___
[url]http://Movies.tinita.de/[/url] \ / _` / _ \/ _ \ '_(_-< of
[url]http://www.perlquotes.de/[/url] \ \ _,_\ __/\ __/_| /__/ perception
- the above mail address expires end of december 2003 -
Tina Mueller Guest
-
Tad McClellan #3
Re: Passing Array Via CGI.pm
shade <shade@lore.cc> wrote:
> I'm a Perl newbie here
[url]http://mail.augustmail.com/~tadmc/clpmisc.shtml[/url]
^^^^ ^^> $q->hidden( -name=>'xlfruit' value='@fruit' ),
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Like this one.
You are missing comma (,) and greater than (>) characters.
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Purl Gurl #4
Re: Passing Array Via CGI.pm
Tad McClellan wrote:
(snipped)> shade wrote:
> You are missing comma (,) and greater than (>) characters.
You have missed other problems which are clearly evident.
Purl Gurl
Purl Gurl Guest
-
Purl Gurl #5
Re: Passing Array Via CGI.pm
Purl Gurl wrote:
> Tad McClellan wrote:(snipped)> > shade wrote:
> > You are missing comma (,) and greater than (>) characters.> You have missed other problems which are clearly evident.
"... (snipped code)"
This is repeated four times in the originating article.
Printed in part after corrections:
<input type="hidden" name="xlfruit" value="@fruit" />
This is not a problem of typographical errors as you and
your alter ego, Tina, would have a reader believe.
This is a problem of an ignorant troll trying to pass
off a bunch of baloney based on a presumption readers
are too stupid to take notice.
It is clear to me you are also trying to pass off a
bunch of baloney based on a presumption readers are
too stupid to take notice, just as "Tina" has tried.
Purl Gurl
Purl Gurl Guest
-
Tad McClellan #6
Re: Passing Array Via CGI.pm
Purl Gurl <purlgurl@purlgurl.net> wrote:
> Tad McClellan wrote:>>> shade wrote:
> (snipped)
>>>> You are missing comma (,) and greater than (>) characters.
>
> You have missed other problems which are clearly evident.
No I didn't.
I stopped reading the article as soon as I saw that the
code presented could not be the real code. [1]
If the OP can't be troubled to post the actual code they want
to discuss, then I'll let somebody else help them, and move
on to helping one of the more conscientious posters.
[1] many people will do that silently, which is why the Posting
Guidelines suggest you avoid it. :-)
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Purl Gurl #7
Re: Passing Array Via CGI.pm
Tad McClellan wrote:
(snipped)> Purl Gurl wrote:> > Tad McClellan wrote:> >> shade wrote:
> >> You are missing comma (,) and greater than (>) characters.> > You have missed other problems which are clearly evident.> No I didn't.> I stopped reading the article as soon as I saw that the
> code presented could not be the real code.
By your own admission you read the problems you missed,
and by your own admission you read four clear indicators
there are no typographical errors, as you claim.
You have forgotten you have me killfiled.
I don't care much for baloney.
Purl Gurl
Purl Gurl Guest



Reply With Quote

