Jump to content

Recommended Posts

Hi,

 

I am fairly new to using this website.

 

I have to create a Budget tool in PHP. I am unsure of how to go about starting this though.

 

The tool is supposed to subtract different items from a total amount.

 

For example, subtracting rent, food, bills etc from a total amount input.

 

This should then go about telling a user how much money they are left off at the end of their session.

 

Any help would be much appreciated!

 

Thank you.

Link to comment
Share on other sites

You've posted this in the wrong section, this forum is for questions and comments about the PHP Freaks website.

 

I'm moving this to application design, since you have no code and it sounds like you haven't even started. 

Link to comment
Share on other sites

You'll probably want to set up a MySQL database to store your users and their budgets. Will this be for one user only or many users with separate budgets? And will it be something they use one-time and enter everything at once, or will they come back and enter their expenses as they spend them?

 

Are you including income as well?

Link to comment
Share on other sites

Many thanks for the reply.

 

I have created a user database for the tool. However, I will need to create a table in the database with the user budgets.

 

This is for one user when they are logged into the session.

 

Essentially, a user will type their monthly income into a section, after this they will enter in how much they spend on rent, food, etc. After this, the tool should show them what they are left with at the end of the month.

Link to comment
Share on other sites

Go back to square 1, and get a pen and a piece of paper. Then start to write down a step-by-step list of what you want the application to do, as detailed as you can, but only using a few words per line (one verb and one noun is perfect). Once you've done that, and you've accurately described everything that your code should do, then you can start to translate said step-by-step list to actual code.

I also recommend reading some basic PHP tutorials, if you are uncertain about the PHP syntax.

 

An example of a step-by-step list as described above:

On every run:
 - Echo input field for income.
 - Echo input field for rent
 - Echo input field for phone bill

On submission:
 - Retrieve and validate income
 - Retrieve and validate rent
 - Retrieve and validate phone bill
 - if validation fails
   - Add error message
   - stop parsing
 - Subtract expenses from income and save as total.

 

And so forth, until you've covered everything you want it to do. ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.