[英]How can I submit a form to two different pages (not at same time)?
我需要將頁面提交到兩個頁面,具體取決於觸發提交的按鈕。 兩個頁面都需要能夠獲取正在發送的$ _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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.