There are a number of ways to approach it, but since you want a numeric value with two decimal places, I'd probably just [man]round/man it:
$cost = round($_POST['cost'], 2);
And of course at that point you should verify the value is within any range constraints before proceeding to use it in your query.