简体   繁体   中英

How can I change PayPal posted variables into local variables?

How can I change PayPal posted variables into local variables? I just want to echo out the amount in my thanks page. How can I do that? I don't know the codes of thanks page. Please help me. And I want to send visitors to my thanks page directly when they click paynow button I want to skip other step. Now paypal show the 2 links 1 is go to my site and 2 is paypal account overview when they hit the paynow button. i don't want to show those links. I am new in this so I don't know much more about this I need help any answer will be appreciated. thanks Here is my code

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="joyson_1310654220_biz@hotmail.com">
<input type="hidden" name="return" value="http://localhost/www/buynow/thank.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"        border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

my thanks page code

  <?php
  $amount = $_POST['amount'];
  echo $amount;
  ?>

You need to persist the information outside of the form submission to paypal:

 $paypalArgs = array(
      "cmd" => "_xclick", 
      "business" => "joyson_1310654220_biz@hotmail.com", 
      "return" => "http://localhost/www/buynow/thank.php", 
      "rm" => "2", 
      "currency_code" => "USD",
      "item_name" => "Teddy Bear", 
      "amount" => "12.99"
 );
 if (!isset($_SESSION)) session_start();
 $_SESSION['paypalArgs'] = $paypalArgs;

Now, whenever the user returns back to you from paypal, you can use:

 <?php
 if (!isset($_SESSION)) session_start();
 echo $_SESSION['paypalArgs']['amount'];
 ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM