Paypal custom field

on paypal i have a hidden post field which is labled custom

<input type=“hidden” name=“custom” value=“4-10”>

What i would like to do when it gets posted back to the ipn i would like it to do the following

the first number 4 set this as $id and the 10 set it as $credits.

in the ipn i has this $custom = $_POST[“custom”];

how would i do this

quick google would this do


$custom = $_POST["custom"];
    $parts = explode("-", $custom);
    $id = $parts[0];
    $credits = $parts[1];

Good that you were able to find the answer. Keep in mind, though, that you’ll get an error if there is no dash in that value. If you can predict that there will always be a dash there, then you’re all set!

If you’re interested, here’s how that could be written in one line.


list( $id, $credits ) = explode( '-', $_POST['custom'] );

cheers dude.

i’ve got about 5 buy now buttons so i have set the custom field myself :slight_smile: but i might implement yours in to my code

thanks :slight_smile: