How to get the value of paypal options in IPN

Discussion in 'PHP' started by PinoyIto, May 22, 2009.

  1. #1
    My paypal Buy Now buttons include a selection where the customer can select from a drop down blox with the item and price.

    My problem now is that how can I identify which of the option was the customer selected in my ipn script.

    here part of the paypal button
    
    input type="hidden" name="on0" value="Credits">Buy Additional Credits <br /> 
    
    <select name="os0"> 
    <option value="3 Credit">$24 - 3 Credit</option> 
    <option value="5 Credit">$40 - 5 Credit</option> 
    <option value="7 Credit">$56 - 7 Credit</option> 
    <option value="10 Credit">$80 - 10 Credit</option> 
    </select> 
    <br /> 
    <!-- Specify the price that PayPal uses for each option. --> 
    
    <input type="hidden" name="option_index" value="0"> 
    <input type="hidden" name="option_select0" value="3 Credit"> 
    <input type="hidden" name="option_amount0" value="1.00"> 
    <input type="hidden" name="option_select1" value="5 Credit"> 
    <input type="hidden" name="option_amount1" value="2.00"> 
    <input type="hidden" name="option_select2" value="7 Credit"> 
    <input type="hidden" name="option_amount2" value="3.00"> 
    <input type="hidden" name="option_select3" value="10 Credit"> 
    <input type="hidden" name="option_amount3" value="4.00">
    
    Code (markup):
    I am thinking of doing this but not sure if this will work
    
    $price1 = $_POST[option_amount0];
    $price2 = $_POST[option_amount1];
    $price3 = $_POST[option_amount2];
    $price4 = $_POST[option_amount3];
    
    Code (markup):
     
    PinoyIto, May 22, 2009 IP
  2. WeedGrinch

    WeedGrinch Active Member

    Messages:
    1,236
    Likes Received:
    73
    Best Answers:
    0
    Trophy Points:
    90
    #2
    I think what you're doing will work, however i've always used single quotes, like so:

    
    $price1 = $_POST['option_amount0'];
    
    Code (markup):
     
    WeedGrinch, May 22, 2009 IP