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
https://forums.phpfreaks.com/topic/274248-php-help/
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?

Edited by Jessica
Link to comment
https://forums.phpfreaks.com/topic/274248-php-help/#findComment-1411280
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.

Edited by vc65
Link to comment
https://forums.phpfreaks.com/topic/274248-php-help/#findComment-1411282
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
https://forums.phpfreaks.com/topic/274248-php-help/#findComment-1411433
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.