In the purchase button of PayPal, there is an input hidden called custom. I can add on him a variable to get it after.
The thing is, I want to get 2 variables.
Actually, I have in the value of the input this: <php? echo $customform ?>
<php? echo $customform ?>
And on listener.php (this receive the post data from paypal) i have got PHPmailer working with the custom variable.
like this: $mail->Body = $_POST['custom'];
So, Paypal only gives one custom field and i want to send something like this:
$customform $loginid
and then work with both variables. How can i do it guys? thank you so much.
You can serialize the variable's value into JSON and pass the data, once you get back the json from PayPal just unserialize it.
// get the user from database
$loggedInUser = 1;
$data = json_encode(array (
'customForm' => $_POST['key'],
'loginId' => $loggedInUser,
));
// {"customForm": "data1", "loginId": "1"}
and whey you get back the result just decode it back to an array.
$result = json_decode ($_POST['custom'], true);
I hope that helps.
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.