By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

php derived total

P: 22
as a novice I can't get this one figured out and would appreciate any advice or help you could offer.

am trying to pass a php derived total to a html form that passes the info to paypal. our form variable with the php looks like this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="hidden" name="amount" value="<?php if(isset($_GET['tc'])) echo ($_GET['tc'] + 25.99 + rTXSTax) ; ?>">
  3.  
  4.  
this works fine with one small problem - that is really hugh. we're running a php routine that generates the order form and allows the user to update quantities for the items they have selected. the value above is generated when the page is produced and if the user makes any changes the amount value is NOT updated when it is passed to paypal.

have tried POST GET and EXPLODE but cant get any of them to work. maybe we could define a variable that would recalculate the value when the form is SUBMIT ed to paypal?????????

please help ... thanks
Dec 8 '07 #1
Share this Question
Share on Google+
1 Reply


P: 41
as a novice I can't get this one figured out and would appreciate any advice or help you could offer.

am trying to pass a php derived total to a html form that passes the info to paypal. our form variable with the php looks like this ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="hidden" name="amount" value="<?php if(isset($_GET['tc'])) echo ($_GET['tc'] + 25.99 + rTXSTax) ; ?>">
  3.  
  4.  
this works fine with one small problem - that is really hugh. we're running a php routine that generates the order form and allows the user to update quantities for the items they have selected. the value above is generated when the page is produced and if the user makes any changes the amount value is NOT updated when it is passed to paypal.

have tried POST GET and EXPLODE but cant get any of them to work. maybe we could define a variable that would recalculate the value when the form is SUBMIT ed to paypal?????????

please help ... thanks
Hopefully I'm understanding this right, but if I'm not please let me know.

You have a form that basically has a list of items (a picture would be nice) and a total on the bottom. When this page is generated it it computes a total of some sort.

You problem is if the user changes any values before submitting it the total isn't updated.

As a friendly reminder PHP is a server-side script. Any changes the user makes after the page is generated will not be updated unless you write a script to accomodate that. If you want to dynamically change values while the user is changing things on the form, I suggest javascript.

I have no idea how this system looks like but here is a possible solution in PHP.

A. Before you submit the form to paypal generate a confirmation page that will display the total. This way you have a chance to update all your values before it is submitted to paypal. If the user feels that everything is correct, the user can press the confirm button.
Dec 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.