PHP to Total Fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Qaysar Akbar
    New Member
    • Oct 2011
    • 1

    PHP to Total Fields

    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.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    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.

    Comment

    Working...