dynamic price with paypal

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

dynamic price with paypal

Post by isaac_cm »

Hello,
I read many script from web sites about this but it did not solve my problem, I need to pass a single item to paypal but with dynamic price

so I write a javascript function like this

Code: Select all

function CalculateOrder(form){
  
        document.form.amount.value = <?php echo $FinalTotal + $k_no; ?>;
    
      }
and in onclick event I call this function

Code: Select all

                           <input type="image" src="https://www.paypal.com/DE//LG.gif" border="0" name="submit"  style="width:160px" onClick="CalculateOrder(this.form)">
 
but I get sometimes error that the amount variable is not correct , or no error but I see a bank edit box in the paypal checkout page instead of the total I want

any solution to this ?

Thanks
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: dynamic price with paypal

Post by onion2k »

Is "document.form.amount.value = <?php echo $FinalTotal + $k_no; ?>;" supposed to calculate the form amount based on the values that the user enters into the form? Coz you can't do that. You need it to be entirely Javascript... no PHP.
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

Re: dynamic price with paypal

Post by isaac_cm »

but php variables hold the values , the values are crom from a post form in a previous page and I read it with $_REQUEST

I see now I can store all $_REQUEST into session and read session variables from javascript, right ? is there any other way ?

thanks
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

Re: dynamic price with paypal

Post by isaac_cm »

never mind it work but I need now to prevent price change
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: dynamic price with paypal

Post by Jonah Bron »

readonly="true" is what you're looking for. Apply it to document.form.amount. Or, you can use a hidden element instead of a text element.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: dynamic price with paypal

Post by arjan.top »

Jonah Bron wrote:readonly="true" is what you're looking for. Apply it to document.form.amount. Or, you can use a hidden element instead of a text element.
that won't prevent nothing
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

Re: dynamic price with paypal

Post by isaac_cm »

yes I think the only way is encryption or review each sale and cancel frauds
Post Reply