【发布时间】:2015-07-28 04:06:27
【问题描述】:
我有两个输入字段,我想将相同的数据发布到两个不同的 php 文件,具体取决于单击的按钮。
在我的例子中,数据只进入foo.php,而不是excel.php。
如果按下第二个按钮,我希望数据转到 excel.php。
JS:
$(function() {
$("#from").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function(selectedDate) {
$("#to").datepicker("option", "minDate", selectedDate);
}
});
$("#to").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onClose: function(selectedDate) {
$("#from").datepicker("option", "maxDate", selectedDate);
}
});
});
HTML:
<form action="foo.php" method="post">
<label for="from">From</label>
<input type="text" id="from" name="from" />
<label for="to">to</label>
<input type="text" id="to" name="to" /> <br>
<input type="submit" value="Viewchart">
</form>
<form action="excel.php" method="post">
<input type="submit" value="Download Excel file">
</form>
【问题讨论】:
-
为什么会有两个单独的表格?
-
是的@tomloprod 它不起作用
标签: php jquery html form-submit