Paypal Hidden variables doesn't work [duplicate]

随声附和 提交于 2019-12-11 14:15:35

问题


Possible Duplicate:
Variables upon submitting Paypal form

//Buy.php
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="hosted_button_id" value="EWE57TOG6A1GO">
    <input type="hidden" name="user_id" value="12345">
    <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>

After the successful payment. You'll be redirected to

www.thankyou.com/thankyou.phptx=2TB90771KK039521H&st=Completed&amt=1.00&cc=PHP&cm=&item_number=11

//Thankyou.php
<?php
    extract($_REQUEST);
    echo $user_id;
?>

I am trying to print the user_id but it is empty.

So my Question is:

1) How can I send variable from my site to paypal? (talking about the user_id)

2) How to get the value of that user_id when redirected to thankyou.php?

Thanks in ADVANCE!


回答1:


Try this. It worked for me when I implemented PayPal.

<?php

    $user_id = $_REQUEST['user_id'];    
    echo $user_id;    

?>

Slight edit: The array parameter should be in quotes and the double quotes are unnecessary in the echo statement.



来源:https://stackoverflow.com/questions/7579908/paypal-hidden-variables-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!