Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Variables (Request)

Status
Not open for further replies.

KizMar

Technical User
Mar 13, 2002
52
US
I'm having an "I've never done this before" issue:

I'm using 2CheckOut to do credit card verification for me. When the transaction is complete, I'm having them redirected back to my page. They say they pass back the customer's variables that I can pull at that point. The problem is, I have no clue how to grab these variables and basically auto-fill my form.

I haven't the slightest clue what I'm doing, and I've tried several different ways to pull the session variables, none seem to work.

Can anyone help me out or is this too vague?
 
Hi

They can either use GET or POST. GET is stored in $ENV{'QUERY_STRING'} and appends to the end of the URL as www.website.com?name=value and POST is invisible and is stored in an environment variable $ENV{'CONTENT_LENGTH'}

Regards
Duncan
 
Check out CGI.pm

type 'perldoc CGI'

this will let you access those variables very easily. Lots of examples in there.

Basically:
---
use CGI ;
my $query = new CGI ; # Sucks in the variables

my $name = $query->param( 'FIRSTNAME' ) ;
## $name now contains the VALUE of FIRSTNAME=VALUE

---

Now, in your form, you want to set the values to these variables as you output it. So something like

input type=text name='FIRSTNAME' value=$FIRSTNAME

etc etc

 
Well, I tried to check out that CGI.PM and that's so far over my head I wasn't even sure WHAT it was.

Is there a way to pull the URL their sending me so I can tell if they're sending me a POST (query string)?

They make it look like I have to have them pass the query back to a routine... "myroutine.pl"... I think I'm missing a step here. I'm trying to pull the ENV variable right into a PHP page with an existing form. Basically using soemthing like:

&quot;<input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot; value=&quot;<?php $_ENV['card_holder_name']; ?>&quot; size=&quot;40&quot; maxlength=&quot;100&quot;>&quot;

But this doesn't work. Does there need to be code at the top of the PHP page that pulls the variables into the page?
 
You are in a perl forum. Consult the PHP forum for PHP tips.

CGI.pm docs tell you all of this if you read in with intent.

POST data is not sent as ENV, hence the requirement for something to pull it out.

GET is query string, POST is body of request.

Tx
 
I'm a Perl newbie, but if your just trying to return any variables that get passed to your script, try this to see what they are sending you and then go from there...

#!/usr/bin/perl
use CGI qw:)standard);

@list = param();

print header();
print start_html;

foreach (@list) {
$var = param($_);
print &quot;<p>$_ = $var</p>&quot;;
}

print end_html;


Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top