wrigd411 Posted December 2, 2013 Share Posted December 2, 2013 I am a php newbie and I have a problem I just cannot figure out. I have a household income and expense calculator form (inc1, inc2, inc3, exp1, exp2, exp3, exp4) I need to calculate total income, total expenses, net income, potential savings and the largest expense category with values entered from the form. My calculations are: $ttl_inc_val = $_POST['ttl_inc] + $inc1 + $inc2 + $inc3; $ttl_exp_val = $_POST['ttl_exp + $exp1 + $exp2+ $exp3+ $exp4; $net_val = $_POST['net'] + $inc1 + $inc2 + $inc3 - $exp1 - $exp2 - $exp3 - $exp4; $p_svgs_val = $_POST['p_svgs'] + $net + $exp4; I still haven't figured out the how-to for the largest expense, but my problem at this point is that I cannot get any of these calculations to post to my database tables (6 in total-don't ask). I did manage to create a few triggers that will calculate my ttl_inc on the income table and another for the expenses table.But that still leaves the other calculations and all are on different tables. I am sure it is probably something silly that I am missing, but I just cannot see it. Probably been staring at this far too long. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/284441-form-field-calculations-and-mysql/ Share on other sites More sharing options...
mike12255 Posted December 7, 2013 Share Posted December 7, 2013 I think I understand what your going for, just to be sure could you post your code please? also code like this: $ttl_inc_val = $_POST['ttl_inc] + $inc1 + $inc2 + $inc3; what is ttl_inc? have you already defined $inc1, $inc2, $inc3 through post variables above this code? Link to comment https://forums.phpfreaks.com/topic/284441-form-field-calculations-and-mysql/#findComment-1461617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.