cedartree Posted December 4, 2008 Share Posted December 4, 2008 hi there. i have a form in which someone fills in their expense information, and when they submit the information, it gets e-mailed. i would like to use the $addition feature in order to total out the information so that I don't have to manually calculate them every time. I would also like to subtract the difference between Income information VS Expense information. This is what I have (everything works except for the math part, so i will leave out the unnecessary code): $total_contents .= "Groceries/Supplies : " . $_POST['GroceriesSupplies'] . "\n\n"; $total_contents .= "Day Care : " . $_POST['DayCare'] . "\n\n"; $total_contents .= "Medical : " . $_POST['Medical'] . "\n\n"; $total_contents .= "TOTAL EXPENSES: " . $_POST [$addition = 'GroceriesSupplies + DayCare + Medical'] . "\n\n"; if you would like i can also e-mail you the php file. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/135545-php-addition-on-mail-form/ Share on other sites More sharing options...
trq Posted December 4, 2008 Share Posted December 4, 2008 Maybe you mean to use..... $addition = $_POST['GroceriesSupplies'] + $_POST['DayCare'] + $_POST['Medical']; $total_contents .= "TOTAL EXPENSES: $addition\n\n"; You code makes little sense. Link to comment https://forums.phpfreaks.com/topic/135545-php-addition-on-mail-form/#findComment-706305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.