Javascript 页面可以';我不能保存历史数据

Javascript 页面可以';我不能保存历史数据,javascript,php,html,history,Javascript,Php,Html,History,我有一个包含动态输入的表单(添加了addRow()函数),问题是当我单击submit按钮时。表单将数据发送到另一个页面(第二个页面),但如果有错误,第二个页面将返回到第一个页面,但问题是表单页面没有保留数据输入 第一页 <table id="tab"> <tr> <th>Ref</th> <th>Designation</th> <th>Prix d'achat<

我有一个包含动态输入的表单(添加了addRow()函数),问题是当我单击submit按钮时。表单将数据发送到另一个页面(第二个页面),但如果有错误,第二个页面将返回到第一个页面,但问题是表单页面没有保留数据输入

第一页

<table  id="tab">
   <tr>
      <th>Ref</th>
      <th>Designation</th>
      <th>Prix d'achat</th>
      <th>Prix de vente</th>
      <th>Qte</th>      
      <th>Remise</th>       
      <th>Montant</th>      
      <th>action</th>       
   </tr>
</table>

裁判
任命
阿查特大奖赛
文特大奖赛
Qte
放松
蒙坦特
行动
添加行输入的函数

<script>
function AddRow_v(nbrn){    
    var newRow = document.getElementById('tab').insertRow(-1);
    var newCell = newRow.insertCell(0);
    newCell.innerHTML = "<td><div class='input_container'><input type='text'  class='input_80 valider' name='ref[]' id='ref_id"+nbrn+"' onkeyup='autocomplet("+nbrn+")' />  <ul id='produits_list_id"+nbrn+"' style='display:none;'></ul></div></td>";
    newCell = newRow.insertCell(1);
    newCell.innerHTML = "<td><input type='text' name='designation[]'  id='designation_id"+nbrn+"'  /></td>";                                        
    newCell = newRow.insertCell(2);
    newCell.innerHTML = "<td><input type='text' id='px_achat"+nbrn+"'  name='px_achat[]' class='input_60 only_number' /></td>";
    newCell = newRow.insertCell(3);
    newCell.innerHTML = "<td><input type='text' id='px_vente"+nbrn+"'  onkeyup='calculez("+nbrn+");' name='px_vente[]' class='input_60 only_number' /></td>";
    newCell = newRow.insertCell(4);
    newCell.innerHTML = "<td><input type='text' id='qte"+nbrn+"'  onkeyup='calculez("+nbrn+");' name='qte[]' class='input_30 only_number' /></td>";
    newCell = newRow.insertCell(5);
    newCell.innerHTML = "<td><input type='text' id='remise"+nbrn+"'  onkeyup='calculez("+nbrn+");' name='remise[]' class='input_30 only_number' /></td>";
    newCell = newRow.insertCell(6);
    newCell.innerHTML = "<td><input type='text' id='montant"+nbrn+"'  readonly name='montant[]' class='input_60 only_number' /></td>";
    newCell = newRow.insertCell(7);
    newCell.innerHTML = "<td><a onclick='remove_v("+nbrn+");' id='remove"+nbrn+"' class='btn' rel='tooltip' data-original-title='Supprimer'><i class='icon-remove'></i></a>";
    document.getElementById('nbrligne').value=count_ligne();

}

函数AddRow_v(nbrn){
var newRow=document.getElementById('tab').insertRow(-1);
var newCell=newRow.insertCell(0);
newCell.innerHTML=“
    ”; newCell=newRow.insertCell(1); newCell.innerHTML=“”; newCell=newRow.insertCell(2); newCell.innerHTML=“”; newCell=newRow.insertCell(3); newCell.innerHTML=“”; newCell=newRow.insertCell(4); newCell.innerHTML=“”; newCell=newRow.insertCell(5); newCell.innerHTML=“”; newCell=newRow.insertCell(6); newCell.innerHTML=“”; newCell=newRow.insertCell(7); newCell.innerHTML=“”; document.getElementById('nbrligne')。value=count_ligne(); }

    第二页

    <?php
    if(error()){
    ?>
    <script>
        window.history.go(-1);
    </script>
    <?php
    }
    ?>
    
    
    window.history.go(-1);
    

    谢谢您的帮助

    是的,现在是学习AJAX的时候了。您也可以来回发布输入,只是确保它们是干净的