do I need to replace total with
this?
On your original post, you posted one Javascript code and two php code block. On your SECOND php code block replace line 2 with what I posted earlier. That line of code is basically removing anything that is neither a number nor a period.
Also, feedback such as "it still doesn't work" is not helpful. Have you verified that it is even attempting to execute the query?
Does it execute the die() statement? If so, try changing the die() statement to: ... or die('Error querying database: ' . mysqli_error($dbc) );
so you can get a description of the error.