1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Standard Paypal Button Code Assist

Discussion in 'PHP' started by wulfgen, Oct 20, 2012.

  1. #1
    Hello

    I have a problem that someone in to php might be able to handle. I am creating a php based Paypal button script and was just advised by the client that they want to have a flat rate of $2.50 for shipping added to the button.

    No problem, I think - I'll just go to the corresponding hidden field <input type="hidden" name="shipping" value="0.00"> and change it to <input type="hidden" name="shipping" value="2.50">

    Yep, easy meat - but nooooo…………

    All this does is add the rate of 2.50 for the entire order - so if someone adds more than one, it still uses the 2.50 What it needs to do is add 2.50 for each item added to the button, there is no way to accomplish this unless they buy a PayPal Pro (and I'm not sure if that is in there anyway)

    So I figure that as the user adds how many of the item in the Dty field <input name="quantity" type="text" size="4" maxlength="4" /> a script of sorts could be applied that multiplies 2.50 by the amount entered into the quantity field and the results are (pushed/echoed in the hidden shipping field

    Something like this: <input type="hidden" name="shipping" value="<?php echo '$multipliedamount'>" >

    I know its wrong and rough - but I don't know how to do it. It would probably need the 2.50 as a variable and then * using the quantity text field value as the numerator, then place the result into the echo….?

    BTW these field names and code are the basic names and strings in any PayPal button code.

    Anyhelp please………
     
    wulfgen, Oct 20, 2012 IP