I have input "Weight: 123,4 kg" i want to save the number to database. so i have a code substr like this
$_POST['product_weight'] =
substr($_POST['product_weight'], 8, 3);
str_replace(',','',$_POST['product_weight']);
But the problem now, output always "123.00". It was mistake from substr or data type?
My form
<input type="text" class='numbering' name="product_weight" value="<?=(!empty($form['product_weight']))?number_format($form['product_weight'],2):''?>">
Output
<td><?=(!empty($each->product_weight))?number_format($each->product_weight,2).' gr':'-';?></td>