Updating PHP checkout page
| From: | Robert | Date: | Fri, 09 Feb 2007 19:29:44 +0000 |
| Subject: | Updating PHP checkout page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248685@lists.php.net to get a copy of this message | ||
Hopefully I will manage to explain my problem and you will have a solution
for it :).
I have a checkout page, coded in PHP (by some other coder, not available
anymore). On the page I have one table containing shopping cart items and
one submission form, to collect all information from the customer. When the
page is loaded, the table is filled with data from the temporary data table
through SQL query (collected on the previous page, shopping cart page),
except for the field about the amount of the sales tax, which is not yet
known because I don't know anything about the customer. So I have a shopping
cart table and a blank form below that, ready to be filled with customer's
information.
Now, my question is: How can I calculate and fill the sales tax field in the
shopping cart table, if the customer chooses his state from the drop down
list in the form? I must say here that the sales tax is only applicable for
residents of just one state, Vermont, because the company is based in
Vermont. For instance, if the customer chooses Vermont as his state, how
this can be translated into sales tax amount, added into the field in the
shopping cart table and recalculated the total amount? Should the page be
reloaded, with changed value of some variable for the sales tax? Should the
JavaScript be used?
All information entered in the form should be kept after the selection of
the state and calculation is made (I assume that the page should be
reloaded/refreshed), so the user shouldn't have to re-enter them again.
After this recalculation, the customer hits the "Make Purchase" button and
the form is submitted and the receipt for the purchase is sent.
I'm not very familiar with PHP or JavaScript, so any help is greatly
appreciated.
Thanks,
Robert