Click to See Complete Forum and Search --> : shopping cart script
cmotor
10-22-2004, 12:48 AM
How do I pass the variables below to the address below
when someone clicks my add to cart button?
VARIABLES:
business=sales@screamingleather.com
item_name=Product
item_number=P100
amount=50.00
quantity1=1
cmd=_cart
no_note=1
currency_code=USD
ADDRESS TO PASS VARIABLES TO:
https://www.paypal.com/cgi-bin/webscr
METHOD=post
TARGET=paypal
solavar
10-22-2004, 01:42 AM
The neat solution would be to use cURL.
Otherwise, store them in a session array when they have been retrieved from wherever. But don't use this same page to post them to PayPal.
Instead, do a header location to a second page which will grab the session array contents and place them into hidden fields on a self-submitting form.
Well you could pass it through the url, which doesn't look too nice in the address bar, or you could do it with sessions. Just put "session_start();" at the top of both pages and on the page where your sending the vars from do this:$_SESSION["business"] = "sales@screamingleather.com";
$_SESSION["item_name"] = "Product";
$_SESSION["item_number"] = "P100";
$_SESSION["amount"] = "50.00";
$_SESSION["quantity1"] = "1";
$_SESSION["cmd"] = "_cart";
$_SESSION["no_note"] = "1";
$_SESSION["currency_code"] = "USD";And on the page you want to echo them or whatever do this:echo $_SESSION["business"];
echo $_SESSION["item_name"];
echo $_SESSION["item_number"];
echo $_SESSION["amount"];
echo $_SESSION["quantity1"];
echo $_SESSION["cmd"];
echo $_SESSION["no_note"];
echo $_SESSION["currency_code"];EDIT: Oh looks like solavar beat me to it. I'll still post because you might find my code useful. :)
cmotor
10-22-2004, 11:40 AM
Thanks.
I forgot to mention that I want to store the variables in a separate file that will be out of view of users. Sorry. I am a PHP newbie.
Does the session_start() go in the same tag as my add to cart button. It looks like a script caller.
And, what code would I use to send the variables to here:
https://www.paypal.com/cgi-bin/webscr
METHOD=post
TARGET=paypal
-cmotor
Illufox
03-10-2005, 05:49 PM
Paypal does that all for you. No coding needed! ;)