Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.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_Javascript_Forms - Fatal编程技术网

Php 如何将表格提交到两个不同的页面(不是同时提交)?

Php 如何将表格提交到两个不同的页面(不是同时提交)?,php,javascript,forms,Php,Javascript,Forms,我需要提交一页到两页取决于哪个按钮触发提交。这两个页面都需要能够拾取正在发送的$\u POST数据。这是我目前所拥有的,但它不起作用 <form name="user" action="" method="POST"> <textarea name="tname" id="tname"></textarea> <input type='button' value='Submit' onclick="document.user.action

我需要提交一页到两页取决于哪个按钮触发提交。这两个页面都需要能够拾取正在发送的$\u POST数据。这是我目前所拥有的,但它不起作用

<form name="user" action="" method="POST">
  <textarea name="tname" id="tname"></textarea>
  <input type='button' value='Submit'
    onclick="document.user.action='edit.php'; document.user.submit(); this.form.target='_self'; return true;">
  <input type='button' value='Preview'
    onclick="document.user.action='preview.php'; document.user.submit(); this.form.target='_blank'; return true;">
</form>


两个页面都在同一个窗口中打开(预览按钮应在新窗口中打开)。

以设置操作的相同方式设置目标,并在提交表单之前设置目标对我有效:

<form name="user" action="" method="POST">
<textarea name="tname" id="tname"></textarea>
<input type='button' value='Submit'
       onclick="document.user.action='edit.php'; document.user.target='_self'; document.user.submit(); return true;">
<input type='button' value='Preview'
       onclick="document.user.action='preview.php'; document.user.target='_blank'; document.user.submit(); return true;">
</form>


请您澄清什么不起作用?我已经在Firefox和IE中进行了测试。看起来表单目标设置是问题所在?在Chrome中,其他一切都非常适合我。