当前位置: 代码迷 >> PHP >> 一个表单两个提交按钮交付不同页面
  详细解决方案

一个表单两个提交按钮交付不同页面

热度:41   发布时间:2016-04-28 19:11:08.0
一个表单两个提交按钮提交不同页面


<form   method="get" name="myForm" action="test5.php" >
<table >
<tr ><td>查询起始时间:<input type="datetime-local" name="start"/></td></tr>
<tr ><td>查询截止时间:<input type="datetime-local" name="end"/></td></tr>
<tr ><td><input type="submit" name="chaxun"  value="查询"  />  //查询按钮提交给test5.php
  <input type="button" name="down"  value="导出xls文件"  /> </td>       //导出xls文件按钮提交给down.php
         </tr>
</table>
</form>

初学,试了几种方法都不行,就只有action提交给哪个页面,哪个页面可以成功,求高手赐教




------解决方案--------------------
在按钮 down 的 onclick 事件中修改表单的 action 属性和执行表单的 submit 方法
------解决方案--------------------
all 啊户型只有 ie 支持
说以应该是
<input type="button" name="down" value="导出xls文件" onclick="down(this.form)" />

function down(form) {
   form.action = "down.php";
   form.submit();
}

------解决方案--------------------
遇到类似的问题 。不用在一个同一个form标签写 。 在新建一个 
<form1   method="get" name="myForm" action="down.php> 
<table >   
  <tr >
     <td><input type="button" name="down"  value="导出xls文件"  /> </td>       //导出xls文件按钮提交给down.php         
 </tr> 
</table> 
</form1>
  相关解决方案