Get Updates (It's FREE)

Results 1 to 13 of 13

Thread: Coding help please: Simple budget calculator

  1. #1
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Question Coding help please: Simple budget calculator

    Hi, I'm fluent in HTML, wordpress, website building, graphics...etc (all the simple stuff) but when it comes to more advanced coding I look for help.

    What I need is for visitors to fill out some details on a simple form (edit: do I mean "table"?). In one column I'd like to create some rows for expense categories (rent, food, utilities...etc) in another column I'd like to include rows for non-essential expenses (entertainment, luxury foods...etc). My aim is for people to split their spending into two broad categories. I'll need a total at the bottom of each column (essential and non-essential) and then I want to add a multiplication factor to each column total. For example I'd like to multiply their essential expenses by a factor. I have a point I'd like to make regarding how much money people need to live comfortable lives (without letting too much out of the bag right now).

    What language should I explore to make this happen? Is there a standard script I can use? can anyone point me to some useful resources that specifically deal with this type of script. I have time to work on learning but would rather play with variables and I can format it myself so it looks all "purrrdy".

    Appreciate any help or guidance you may have.

  2. #2
    (14) Hyundai
    Joined
    Jan 2012
    Age
    31
    Posts
    13
    Thanks
    9
    Thx'd 4 times in 4 Posts

    Default

    PHP would handle this pretty easily and would be fairly simple for what you're wanting. If you wanna save some time, just find a simple PHP form script and modify it to add your fields and do the math.

  3. The Following User Says Thank You to jgearheart For This Useful Post:

    V8Bill (Feb 11th, 2012)

  4. #3
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Default

    Quote Originally Posted by jgearheart View Post
    ...find a simple PHP form script and modify it to add your fields and do the math
    Thanks, can you be a little more specific? How do I add math to a simple form script? By simple form script I'm presuming you mean a form like a feedback or contact us type form?

    Also, I want it to add up on the fly by pressing a "calculate" or "re-calculate" function without taking them off the page. I'd like for them to be able to play with it while staying on the page. I'd also (now that I think some more on it) like to make comments based on the factor of essential expenses versus income. For example, if they are living below their means by a certain factor I want to congratulate them and encourage further savings or increased income.

    I could make a simple spreadsheet they could download I suppose but I want to keep them on the site if possible.

  5. #4
    (8) Acura
    Joined
    Jul 2011
    Posts
    239
    Thanks
    8
    Thx'd 49 times in 42 Posts

    Default

    if you want to change values inside field there are two ways

    1- modify the html elements using javascript "on the fly"
    2- reload the page and either copy what was inside the cell or replace with the newly calculated values

    both will yield the same result, the latter is easier to do but will generate much more page loads and php calls, the former will have everything done on the client-side.

  6. #5
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Default

    Thanks.

    I guess I may be looking for more of an "applet" than static code. I don't want people to have to refresh the page every time they add a new amount into a cell. I want them to enter into a cell and watch the effect it has on their "bottom line" like Excel I suppose. It would also be cool if they could save their work for later.

    I'll see if I can find an example and post back here.

  7. #6
    Pat
    Pat is offline
    (9) Cadillac Pat's Avatar
    Joined
    Jun 2011
    Locale
    World Traveler
    Age
    23
    Posts
    161
    Thanks
    59
    Thx'd 30 times in 26 Posts

    Default

    JavaScript can do that.

    field.change or something like that. Just let the calculations run through on every change.

  8. #7
    (6) Mercedes zendolphin's Avatar
    Joined
    Apr 2011
    Age
    42
    Posts
    474
    Thanks
    131
    Thx'd 558 times in 239 Posts

    Default

    I had a a calculator on one of my sites. I think we found a code snippet from a php library. ( I don't code)
    I hired a PHP wiz to crank it out, I think it cost me 30 bucks and took 2 days.

    just have a code monkey look up something online. there are lots out there.

  9. #8
    (14) Hyundai
    Joined
    Jan 2012
    Locale
    Redondo Beach
    Age
    33
    Posts
    15
    Thanks
    7
    Thx'd 4 times in 4 Posts

    Default

    That sounds like something you'd want to do with Asynchronous Javascript and XML ("AJAX"). There's a quick tutorial here: AJAX Tutorial. JQuery is a very popular AJAX framework that can handle a lot of the "purdy" parts, and you can definitely do simple addition & multiplication in Javascript to calculate a budget.

  10. #9
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Default

    Thanks Pat, Zendo and Walter.

    A super duper special thanks to AndrewNC who stayed up until 5am tonight to create and perfect the code and mathematics in PHP. I wanted to pay him but he refused. An example of Fastlaners stopping to help others.

    See what you've created MJ? Nice work.

  11. #10
    (14) Hyundai
    Joined
    Jan 2012
    Age
    31
    Posts
    13
    Thanks
    9
    Thx'd 4 times in 4 Posts

    Default

    Glad ya got it sorted out!

  12. #11
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Default

    Thanks and you were right (by the way), PHP handled it just fine. All I need is to make it look purrrdy and it's ready for a page.

  13. #12
    (6) Mercedes healthstatus's Avatar
    Joined
    Apr 2011
    Locale
    Indianapolis, IN
    Posts
    450
    Thanks
    65
    Thx'd 248 times in 165 Posts

  14. The Following User Says Thank You to healthstatus For This Useful Post:

    V8Bill (Feb 16th, 2012)

  15. #13
    (11) Honda V8Bill's Avatar
    Joined
    Feb 2012
    Locale
    Adelaide, South Australia
    Age
    48
    Posts
    64
    Thanks
    16
    Thx'd 22 times in 18 Posts

    Default

    Thanks! That's cool! I'd love to try it out. Do you know of any websites that use it?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Perry's simple tax plan not so simple
    By News-Mod in forum Economy & Finance News
    Replies: 0
    Last Post: Oct 25th, 2011, 04:30 PM
  2. coding advice...
    By sk24iam in forum Web Businesses/Internet Marketing
    Replies: 38
    Last Post: Jun 28th, 2010, 04:51 PM
  3. Precious Metal Calculator
    By JayKim in forum Off-Topic Discussion
    Replies: 0
    Last Post: Jun 12th, 2010, 04:33 AM
  4. Cool Calculator
    By LaughedAt in forum Fastlane Forum Funnies
    Replies: 2
    Last Post: Jul 30th, 2008, 10:30 PM
  5. Longevity Calculator
    By Runum in forum Off-Topic Discussion
    Replies: 5
    Last Post: May 12th, 2008, 10:17 PM

Tags for this Thread

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
  •