title: How to Store data in DB as decimal precision 4.2
body: <p>I am new to JS and HTML and I have a form. In the input fields I get number (%). I need to store it as &quot;<code>have a precision of decimal (4,2)</code>&quot;. Is there a solution using HTML? This is want I'm trying to do:</p>
  <ol>
  <li>If the number is 1 to store it as 1.00.</li>
  <li>If the number is 1.23 store as it is.</li>
  <li>If the number is 1.12345 store as 1.12</li>
  <li>If the number is 1.2 store as 1.20</li>
  <li>If the number is empty store 0.00</li>
  </ol>
  <p>In the value I display the value from the DB, and 0.00 if nothing in DB. However the problem is when I press save and it sent to the DB. Is there a solution?
  I am using MySQL DB Using laravel</p>
  <p><a href="https://i.stack.imgur.com/Elx8x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Elx8x.png" alt="enter image description here" /></a></p>
  <pre class="lang-html prettyprint-override"><code>&lt;div class=&quot;d-flex&quot; style=&quot;display: flex;&quot;&gt;
      &lt;input type=&quot;number&quot; name=&quot;fee_ctv_omp_percent&quot; id=&quot;fee_ctv['omp_percent']&quot; value=&quot;{{$fee_ctv['omp_percent'] ?? '0.00'}}&quot; class=&quot;w-100&quot;  step=&quot;0.1&quot;  max=&quot;100&quot; style=&quot;border:none;&quot;&gt;
      &lt;span class=&quot;table-control-addon-right&quot;&gt;%&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>