Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将html表发送到php_Javascript_Php_Html_Validation_Bootstrap 4 - Fatal编程技术网

Javascript 将html表发送到php

Javascript 将html表发送到php,javascript,php,html,validation,bootstrap-4,Javascript,Php,Html,Validation,Bootstrap 4,我在表单中创建了一个表,但这是唯一没有获取的内容 使用bootstable创建此表 单元格的表格和一些按钮控件使其可编辑,并可以添加或删除行: <table class="table table-bordered table-striped table-hover table-condensed text-center" id="DyanmicTable" name="DyanmicTable"> <thead> <tr>

我在表单中创建了一个表,但这是唯一没有获取的内容

使用bootstable创建此表

单元格的表格和一些按钮控件使其可编辑,并可以添加或删除行:

<table class="table table-bordered table-striped table-hover table-condensed  text-center" id="DyanmicTable" name="DyanmicTable">
    <thead>
        <tr>
            <th class="text-center">Repère</th>
            <th class="text-center">Quantité</th>
            <th class="text-center">Segments</th>
      <th class="text-center">Fixations latérales</th>
      <th class="text-center">Dalle à gauche</th>
      <th class="text-center">Commentaires</th>
            <th class="text-center">
        <button id="addNewRow" class="waves-effect waves-light btn">Ajouter une ligne</button>

            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
        </tr>
    </tbody>
</table>

雷佩尔
定量
部分
平面固定
胡扯
评论
外部对齐
用于获取表单并将其发送到PHP的脚本:

<script>
  const myForm = document.getElementById('msform');

  myForm.addEventListener('submit', function (e) {
    e.preventDefault();

    var formData = new FormData(this);

    fetch('test.php',{
      method: 'post',
      body: formData,
    }).then(function (response) {
      return response.text();
    }).then(function(text){
      console.log(text);
    }).catch(function(error) {
      console.log(error);
    });
  });

</script>

const myForm=document.getElementById('msform');
myForm.addEventListener('submit',函数(e){
e、 预防默认值();
var formData=新formData(本);
fetch('test.php'{
方法:“post”,
正文:formData,
}).然后(功能(响应){
返回response.text();
}).然后(函数(文本){
console.log(文本);
}).catch(函数(错误){
console.log(错误);
});
});

我建议在PHP代码中使用此函数,不要捕捉错误

<? include('table.html') ; ?>


表单在哪里?可编辑时,是否有任何输入元素?表格本身无法提交,即使放在表单中也是如此。更好的标题、文本和代码我的源代码在这里