Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.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
Php 表单数据不一致,提交后重置_Php_Html_Forms - Fatal编程技术网

Php 表单数据不一致,提交后重置

Php 表单数据不一致,提交后重置,php,html,forms,Php,Html,Forms,这很难解释,所以请容忍我 我正在构建一个包含多个表单的页面,所有表单都通过底部的一个提交按钮提交,如下所示: <form action="" method="post"> <input type="text" name="name1" value="<?$variable1;?>" placeholder="Type here..."> <form action="" method="post"> <input type="text" na

这很难解释,所以请容忍我

我正在构建一个包含多个表单的页面,所有表单都通过底部的一个提交按钮提交,如下所示:

<form action="" method="post">
<input type="text" name="name1" value="<?$variable1;?>" placeholder="Type here...">

<form action="" method="post">
<input type="text" name="name2" value="<?$variable2;?>" placeholder="Type here...">

<form action="" method="post">
<input type="text" name="name3" value="<?$variable3;?>" placeholder="Type here...">

<form action="" method="post">
<input type="text" name="name4" value="<?$variable4;?>" placeholder="Type here...">
<input type="submit" name="submit" value="Submit">

</form>
但是,当我们在表单字段中输入新内容时,变量现在不会更改…


 <form action="" method="post">
 <input type="text" name="name1" value="<?$variable1;?>" placeholder="Type here...">
 <input type="text" name="name2" value="<?$variable2;?>" placeholder="Type here...">
 <input type="text" name="name3" value="<?$variable3;?>" placeholder="Type here...">
 <input type="text" name="name4" value="<?$variable4;?>" placeholder="Type here...">
 <input type="submit" name="submit" value="Submit">
 </form>

您需要
等。否则它不会输出任何内容。

每个表单都是一个单独的实体,您需要使用
关闭它们,但这将阻止使用“提交”按钮一次提交所有表单字段。你有办法吗?@id0827502只声明一份表格。看到我的回答了吗?你不能嵌套表单。我试过了,但似乎不起作用。如果我在第一个表单字段中输入数据,忽略其余部分并提交,那么只有第一个表单字段数据会回显到文本框中。如果我用数据填写其他3个表单字段并再次点击提交,则其他3个表单字段的数据会回显到文本框中,但不会回显到第一个文本框中。然后,您必须使用php代码执行此操作。如果“如果”的话,那就太多了。向您展示r php代码,我们可能会帮助您
 <form action="" method="post">
 <input type="text" name="name1" value="<?$variable1;?>" placeholder="Type here...">
 <input type="text" name="name2" value="<?$variable2;?>" placeholder="Type here...">
 <input type="text" name="name3" value="<?$variable3;?>" placeholder="Type here...">
 <input type="text" name="name4" value="<?$variable4;?>" placeholder="Type here...">
 <input type="submit" name="submit" value="Submit">
 </form>