please help -- where are my variables??

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Auroralei

Thread Starter
Joined
Jun 10, 2004
Messages
16
I have a very simple script and a very simple form.

My problem is that when i send the form variables to the script, I can't do anything with them. See the script below: All I want it to do is print "The item number is "item_number". What I get is "The item number is (blank)"

Can someone please tell me what the problem is?

#!/usr/bin/perl
use strict;
use lib qw(C:/Perl/lib);
use CGI qw:)standard escapeHTML);
use DBI;

my $query;
my %form;
my $item_name;
my $item_number;

my @pairs;
my $pair;
my $name;
my $value;


read (STDIN, $query, $ENV{'CONTENT_LENGTH'});

%form = &parse;


$item_name = $form{item_name};
$item_number = $form{item_number};


&deliver_product;


sub parse {
@pairs = split(/&/, $query);
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;
}


sub deliver_product {


print <<EOF;
Content-Type: text/html\n\n

<html>
<head>
<title></title>
</head>
<body>
The item number is $item_number
</body>

</html>
EOF
}
}

exit (0);




And here's the form I use:

<HTML>
<head>
</head>

<body>

<form method="post" action="http://www.worldwidetattoodesigns.com/cgi-bin/shortshort.pl" target="_blank">
<input type="hidden" name="item_name" value="Fairy Girl on Ladybug Flower">
<input type="hidden" name="item_number" value="BPFAGI0002FWP">
<input type="submit" value="Test IPN">
</form>

</BODY>
</HTML>
 
Joined
Sep 15, 2004
Messages
40
Any reason why you specifically want to use Perl?

I'm rather rusty on Perl but could look later if needs be. You could reduce the size of the script to almost nothing with PHP though.

:)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top