Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder optimus203's Avatar
    Join Date
    Sep 2008
    Location
    CT
    Posts
    317
    Thanks
    22
    Thanked 16 Times in 15 Posts

    Form totals without having to submit form?

    Hey everyone. I have a project I'd like to create, but need some help with (Note, I am a newbie with PHP).

    I want to create a carbon footprint calculator as part of a school project. The equations will be created using PHP equations and a form for user input values.

    I would like to know if (and how) the totals for the users input can be displayed on the screen, without the user having to submit the form. Thanks in advance for your help.
    Always thank those CF Users who help you solve issues...
    Connecticut Web Design

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by optimus203 View Post
    Hey everyone. I have a project I'd like to create, but need some help with (Note, I am a newbie with PHP).

    I want to create a carbon footprint calculator as part of a school project. The equations will be created using PHP equations and a form for user input values.

    I would like to know if (and how) the totals for the users input can be displayed on the screen, without the user having to submit the form. Thanks in advance for your help.
    It would be best to use Javascript to get calculations without reloading the page.

    http://codingforums.com/javascript-programming/


    ------



    -----------
    Leonard Whistler

  • #3
    Regular Coder optimus203's Avatar
    Join Date
    Sep 2008
    Location
    CT
    Posts
    317
    Thanks
    22
    Thanked 16 Times in 15 Posts
    Thats what I was thinking. Do you have a link to a particular thread that will help? Looking right now for a solution on the link you provided, but haven't been able to find the right thread yet. Thanks.
    Always thank those CF Users who help you solve issues...
    Connecticut Web Design

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Here is an example:

    http://www.javascriptkit.com/script/cut18.shtml




    ----------------
    Leonard Whistler

  • #5
    Regular Coder optimus203's Avatar
    Join Date
    Sep 2008
    Location
    CT
    Posts
    317
    Thanks
    22
    Thanked 16 Times in 15 Posts
    I'm trying to find something a little more complex, like this:
    http://www.nature.org/initiatives/cl...ge/calculator/
    Always thank those CF Users who help you solve issues...
    Connecticut Web Design

  • #6
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    If you're wanting it to work live, use a javascript calculator like Len has suggested. PHP requires a request to be sent to the server, so the only way that it can be run is to either reload the page with a form submission or send an AJAX request to the server instead, and is a little overkill for your needs since javascript alone can handle this
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)


  •  

    Posting Permissions

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