[email protected] Posted January 23, 2007 Share Posted January 23, 2007 Hello,I have a PHP Form with a number of numeric fields. I also have a "total amount" field.When a user fills in all the fields and clicks "submit" the results are sent to a MySQL database. How do I get the "totalamount" field filled.Fields:amount1amount2amount3totalamountIf someone could show me some sample code I'd be very greatful.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/35369-adding-numeric-fields-from-a-form/ Share on other sites More sharing options...
complex05 Posted January 23, 2007 Share Posted January 23, 2007 [code]$total = $amount1 + $amount2 + $amount3;$totalamount = number_format($total);mysql_query("INSERT INTO table (amount1,amount2,amount3,totalamount) VALUES ('$amount1','$amount2','$amount3','$totalamount')");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35369-adding-numeric-fields-from-a-form/#findComment-167166 Share on other sites More sharing options...
[email protected] Posted January 23, 2007 Author Share Posted January 23, 2007 Thanks for that. Quote Link to comment https://forums.phpfreaks.com/topic/35369-adding-numeric-fields-from-a-form/#findComment-167241 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.