SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    Shropshire
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Sum fields in PHP form using JS

    I am trying to get the total of 3 form fieds displayed in another form field which will update as numbers are entered. This is a php form and the all the amounts in these fields (including the total) need to be stored into the DB through the PHP on submission.

    I have no idea about JS and so don't even know where to begin and I obviously can't submit the form through the JS as it needs to go through the PHP.

    I hope this makes sense and that someone can point me in the right direction.

    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Mermaid beach 4218
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    chilli you to need to have onChange handlers on the input fields , so that when a number is added to a field, it totals the sum othe 3 fields and then diplays that in the other field. but you might want to just calculate the total with php, server side.
    why would you store the total when it can be calculated with the others fields, its a waste of space?

  3. #3
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    Shropshire
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your reply, but as I said I don't know anything about JS and wouldn't know were to start with using onChange handlers or anything else.

    The reason for it is because it is what the client has requested - he wants it visible on the form and all the form contents are emailed and stored within his DB when submitted which he then contects to using Access for his own system.

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    use the search button above. search for my name & onchange there should be a recent example there. I think poop-shoot is in the thread also.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •