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

PHP to Total Fields

P: 1
I want to create a form with 4 columns and 10 fields etc.

Titles:
Column 1 - Product Name
Column 2 - Qty
Column 3 - Price
Column 4 - Line Total

At the bottom I want to have the following fields

Sub-Total
VAT (TAX)
Total

I need to find a PHP ajax solution that will do the following.

1) When I add the qty and price it automtaically calculates the line total which is automatically updated (qty x price) using Ajax.

2) When the line total is done this updates the following fields using Ajax.

1. Sub-Total
2. VAT (TAX)
3. Total


Sub-Total - Takes the figures from Line Total and adds them
Vat - Takes the Sub-Total and figures out what the VAT/TAX amount is (i.e. 20 of the sub-Total)
Total - Takes the Sub-Total and VAT/TAX and adds them to give total.

Than I want to add these details into a MySQL database.

All help is much appreciated.
Oct 7 '11 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,366
With the exception of inserting the data into MySQL, all of that can be done with just Javascript. As for the insert, you can just have the form post back to itself, there's not really a need to use AJAX unless you don't want the form refreshing or something.
Oct 7 '11 #2

Post your reply

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