2011-08-19 109 views
0

請幫忙,我有一個簡單的網頁表單,當按下提交按鈕時,我希望表單將數據發佈到兩個網址,同時立即重定向到其中一個網址。使用http發佈表單數據到兩個網址獲取

這是我在表單提交後在php重定向頁面上設置的內容。如何添加第二個網址並將其重定向至其中一個網址?

<? $aff = $_GET['aff'] ; $click_id = $_GET['click_id'] ; $email = $_GET['from']; $fname = $_GET['name_(awf_first)']; $lname = $_GET['name_(awf_last)']; $zipcode = $_GET['custom_zipcode']; $address = $_GET['custom_address']; $phone = $_GET['custom_phone_number']; $state = $_GET['custom_state']; $city = $_GET['custom_city']; $subid = $_GET['meta_adtracking'] ; $cblink = $_GET['cblink']; $keyword = $_GET['keyword'] ; $keyword = eregi_replace('[^a-z0-9 ]', '2', $keyword); ?> <META HTTP-EQUIV="refresh" CONTENT=0;URL="http://ian.smileymedia.com/r2/?placementID=shopper&email=<?print $email?>&fname=<?print $fname?>&lname=<?print $lname?>&state=<?print $state?>&zip=<?print $zipcode?>&hphone=<?print $phone?>&mphone=<?print $phone?>&country=US&pubSubID=<?print $subid?>&city=<?print $city?>&addr=<?print $address?>"> 
<html> 
<body> 
</body></html> 

回答

-1
  1. 添加處理程序上提交事件。
  2. 使用AJAX將數據發送到第一個URL。
  3. 使用像form.submit()這樣的標準方法將數據發送到主URL。

嘗試使用這樣的:

<form onsubmit="submit();return false;"> 
..... 
</form> 

的javascript:

function submit() 
{ 
var form = document.getElementById('formName'); 

using ajax - see http://en.wikipedia.org/wiki/XMLHttpRequest 
return form.submit(); 
} 
+0

你能證明此方法示例代碼? – user818709

+0

表單頁面在PHP中編碼並使用http後 – user818709

+0

這不是問題。你可以在php文件中編寫這段代碼。我放下了在提交表單期間調用自定義處理程序的示例,這個應該使用javascript來完成。 –