0

一部のフォーム フィールドが mysql データベースから再ロードされるという問題があります。現在、フィールド タイプを 10 進数の 10,4 に設定していますが、これはデータを正しく保存しているように見えるので、1.3453 と入力するとデータベースに正しく保存されます。データをリロードすると問題が発生します。価格の編集をクリックすると、php がデータをフォーム フィールドにリロードします。問題は、データが切り捨てられていることです。たとえば、データベース内の価格が 1.3453 である場合、データベース内では 1.3453 と表示されますが、フォーム フィールドに再度表示されると 1.34 と表示されます。

これは私が使用しているフォームコードです:

<div class="oilprices" style="width:800px; height:auto; float:left;margin-left:15px;">
          <div style="float:left; width:235px "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong><span style="font-weight:bold;margin-top:4px; float:left;"><span style="font-size:15px; padding-right:10px;">Oil Prices -   </span> Gas Oil</span> £</strong>
              <input name="oilpricegasoil" style="padding:3px !important; background:#fff;" type="text" class="form-field" id="oilpricegasoil" title="oilpricegasoil" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
        </span></div>
          <div style="float:left; width:130px; margin-left:5px; "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong>Derv £</strong>
              <input name="oilpricederv" type="text" style="background:#fff;padding:3px !important;" class="form-field" id="oilpricederv" title="oilpricederv" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
        </span></div>
          <div style="float:left; width:135px; margin-left:5px; "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong>Kero £</strong>
              <input name="oilpricekero" style="background:#fff;padding:3px !important;" type="text" class="form-field" id="oilpricekero" title="oilpricekero" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
        </span></div>
        <input name="cf_id" type="hidden" id="cf_id" value="">
        <div style="width:40px; float:left;padding-left:10px"> 

            <input type="submit" name="button" id="button" value="Update">

        </div>


        </div> 
4

0 に答える 0