I am trying to insert data about an item's price from an HTML form into a mySQL database. The input field is defined as follows:
<input type="text" name="price" value="0.00"/>
The form is POSTed to the next page in which the database stuff is taken care of. Currently I just enter the exact contents of $_POST['price'] into the database field, which has type DECIMAL(4,2). I heard that this was stored as a string but the database throws an error whenever I try and do this. Is there a PHP function for converting between strings and the MySQL DECIMAL type? Or will I have to do some formatting myself?