When a user clicks on the buy button, I want some of their info to be passed through the paypal payment pages and back to the 'success' page at the end so that a confirmation email can be send. I've tried many of paypals variables as hidden fields but I'm getting empty variables when i try to retrieve them. Below I've tried paypal standard variables 'custom' and 'item_number'
The form side
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_number" value="1">
<Input type="hidden" name="custom" value="2"/>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="2DLZKMQ7G6DVY">
<input type="image" src="css/images/checkout.png" width="124" height="40" border="0" name="submit">
</form>
This is the retrieval after payment to test variables
echo $_POST["item_number"];
echo $_POST["custom"];
Both of these are empty. Thanks for any help in advance.
This question has already been answered numerous times, but you can in fact use the custom field to pass Data to Paypal that returns in the IPN call.
Mostly you only need the one field since you can encode an entire JSON object into custom.
Your HTML all looks clear, so try
var_dump($_POST);
and see what you get.