txt3rob — 2013-09-20T10:23:37-04:00 — #1
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
txt3rob — 2013-09-20T10:26:35-04:00 — #2
quick google would this do
$custom = $_POST["custom"];
$parts = explode("-", $custom);
$id = $parts;
$credits = $parts;
qmonkey — 2013-09-21T07:05:51-04:00 — #3
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'] );
txt3rob — 2013-09-21T07:24:35-04:00 — #4
i've got about 5 buy now buttons so i have set the custom field myself but i might implement yours in to my code