correct checkout with php

hello there experts,
i wrote this code, if i have any error please correct me. im trying to make a link like this
https://www2.2checkout.com/2co/buyer/purchase?sid=208628&total=350&quantity=1&cart_order_id=test+name

total = price $350
quantity = 1
cart_order_id = his last and first name

---------
<?PHP
// the url were i have to checkout
$twoco_url = "https://www2.2checkout.com/2co/buyer/purchase?sid=208628";

// total price that i have in the bottom
$final_price = "total";

//  quantity almost all are 1 pack of 500
$product_quantity = "quantity";

// in here i need to generate a unique code for my checkouts
$unique_id_product = "Postcard for $last_name $frist_name";
?>
<html>
<head>
<title>Postcard</title>
</head>
<BODY>
<form name="checkout" action="<?PHP echo $twoco_url; $total; $quantity; $cart_order_id; ?>" method="POST">
<input type="hidden" name="cart_order_id" value="<?PHP echo $unique_id_product; ?>">
<input type="text" name="last_name" maxlength="30"><BR>
<select name="quantity" onchange="total.selectedIndex = selectedIndex;">
<option value="1">250 Pack</option>
<option value="1">500 Pack</option>
</select>
<select name="total" onchange="quantity.selectedIndex = selectedIndex;">
<option value="150">$350</option>
<option value="200">$200</option>
</select>
<br>
  <input name="submit" type='submit' value='Buy Now' >
</form>
</p>
</body>
</html>
XtryAsked:
Who is Participating?
 
hernst42Commented:
It seems that your script relies on register_globals on.
You might try this:

ction="<?PHP echo $twoco_url."&total=".$_REQUEST['total']."&quantity=".$_REQUEST['quantity']."&cart_order_id=".$_REQUEST['cart_order_id']; ?>"
0
 
hernst42Commented:
here is a problem:

<?PHP echo $twoco_url; $total; $quantity; $cart_order_id; ?>
should be:
<?php echo $twoco_url; ?>

The  $total; $quantity; $cart_order_id; will do nothing.

to get such an uer, change the method from POST to GET, If the user hists submit that url will be send to your webserver.
0
 
XtryAuthor Commented:
well it had problems but it was working now is not working
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sandoshvrCommented:
Hi,
replace this
action="<?PHP echo $twoco_url; $total; $quantity; $cart_order_id; ?>"

by
action="<?PHP echo $twoco_url."&total=".$total."&quantity=".$quantity."&cart_order_id=".$cart_order_id; ?>"
0
 
hernst42Commented:
what is your problem excatly. Are the parameters send to https://www2.2checkout.com/2co/buyer/purchase not correct or have they wrong values?
0
 
XtryAuthor Commented:
0
 
XtryAuthor Commented:
ok please correct me my "sid" is not working the rest is working perfect =)

<?PHP
// here is the url were i have to checkout
$twoco_url = "https://www2.2checkout.com/2co/buyer/purchase";
// my 2co id
$my_twoco_id = "208628";
// here is the total price that i have in the bottom
$final_price = "total";
// here is have quantity almost all are 1 pack of 500
$product_quantity = "quantity";
// unique
$unique_product_id = "cart_order_id";
?>
<html>
<head>
<title>Postcard</title>
</head>
<BODY>
<form name="checkout" action="<?PHP echo $twoco_url."?sid=".$my_twoco_id."&total=".$_REQUEST['total']."&quantity=".$_REQUEST['quantity']."&cart_order_id=".$_REQUEST['cart_order_id']; ?> method="POST">
first name: <input type="text" name="cart_order_id" maxlength="30"><BR>
<select name="quantity" onchange="total.selectedIndex = selectedIndex;">
<option value="1">250 Pack</option>
<option value="1">500 Pack</option>
</select>
<select name="total" onchange="quantity.selectedIndex = selectedIndex;">
<option value="150">$350</option>
<option value="200">$200</option>
</select>
<br>
  <input name="submit" type='submit' value='Buy Now' >
</form>
</p>
</body>
</html>
0
 
Diablo84Commented:
There doesnt seem to be a problem with the sid code wise however you had a missing "

here:

<form name="checkout" action="<?PHP echo $twoco_url."?sid=".$my_twoco_id."&total=".$_REQUEST['total']."&quantity=".$_REQUEST['quantity']."&cart_order_id=".$_REQUEST['cart_order_id']; ?>" method="POST">

Just before method.
0
 
XtryAuthor Commented:
omg =( i must be blind about 30 mins trying to figureout
well thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.