Gossamer Forum
Quote Reply
STDIN
Ok, this is getting me quite annoyed! Shouldnt the following code put the values of all the inputted info (wether via POST or GET) into variables within @input?

It just doesnt seem to like it when using POST Frown

if ($ENV{REQUEST_METHOD} eq "GET") {

$forminput = $ENV{'QUERY_STRING'};
@input = split(/&/, $forminput);

} else {

read(STDIN, $forminput, $ENV{'CONTENT_LENGTH'});
@input = split(/&/, $forminput);

}

Thanks

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [youradds] STDIN In reply to
Ugh, forget all that archaic parsing code just use CGI.pm
Quote Reply
Re: [PaulWilson] STDIN In reply to
I'd love to. Would that code work though? Tongue

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [youradds] STDIN In reply to
Well surely that is irrelevant if you use CGI.pm

The code to parse forms can be found all over the Internet. If you want to find some that works Im sure you could do so with a quick search on Google.
Quote Reply
Re: [PaulWilson] STDIN In reply to
Well, in some scripts they use;

@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

But the code I use should do almost that, or shouldnt it? All I want to do is put the content of the query string into an array, andf then i can split them up further when I want to.

I do want to use CGI.pm, but I cant see how it would work for me!

I need all of the info put into that array, so i can use it later in the script!. The way the CGI.pm (standard) module seems to work is to put them with just the result of the name, and not the name of what was submitted! If you know a way around this, then please let me know!

Thanks

Andy

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [youradds] STDIN In reply to
Quote:
I do want to use CGI.pm, but I cant see how it would work for me!

So I'm guessing you just want some code?

---------------------------------------

use CGI qw(:standard);

my $lazy = new CGI;
my @wink = ();

foreach ($lazy->param()) {
push @wink, $lazy->param($_);
}

There, all input stored in @wink.

Quote:
The way the CGI.pm (standard) module seems to work is to put them with just the result of the name, and not the name of what was submitted! If you know a way around this, then please let me know!

Sorry ya lost me.

Last edited by:

PaulWilson: Sep 14, 2001, 5:12 AM
Quote Reply
Re: [PaulWilson] STDIN In reply to
What would that push into the array, just the value of the field, or the fields name too?

Basically what I need to do is have the array split later on, to be displayed like;

FieldName = Value

I am assuming the way you are doing it just pushes the values of the submitted data into the array, or does it actually put the name of the input, and its value?

Sorry if I lost you earlier Sly

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [youradds] STDIN In reply to
Stored in earch array element with this code will be name=value

Code:
use CGI qw(:standard);

my $lazy = new CGI;
my @wink = ();

foreach ($lazy->param()) {
push @wink, "$_=$lazy->param($_)";
}
Quote Reply
Re: [PaulWilson] STDIN In reply to
Thats great. Wasnt sure if you could do that with CGI.pm. Mind you, you can do alomst anything with Perl, should have guessed you could do something as simple as this with it....lol Smile

Thanks

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [PaulWilson] STDIN In reply to
Slight prob with that code! It sends it in the form of;

email=CGI

recipient=CGI

subject=CGI

Any ideas?

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [youradds] STDIN In reply to
Oh well, managed to fix it Smile I ended up using;

Code:
foreach my $key ($listings->param())
{
my $value = $listings->param($key);
push @input, "$key=$value";
}

Thanks though, you got me on the right lines :)

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!