SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [SOLVED]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
    Last edited by txt3rob; Sep 20, 2013 at 07:52. Reason: found solution

  2. #2
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    quick google would this do
    PHP Code:
    $custom $_POST["custom"];
        
    $parts explode("-"$custom);
        
    $id $parts[0];
        
    $credits $parts[1]; 

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.
    PHP Code:
    list( $id$credits ) = explode'-'$_POST['custom'] ); 
    - Robert

  4. #4
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers dude.

    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

    thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •