2013-10-19 72 views
0

朋友..!執行聯繫表格代碼後php重定向

我想幾秒鐘到PayPal payflow的環節後重定向:

https://pilot-payflowlink.paypal.com/?MODE=TEST&SECURETOKENID=f976bec739fb40a5a0e48c1876d570e6&SECURETOKEN=7yVdfkdwbgkOzAg2h1vxHggvL

接觸表單中輸入信息,然後點擊發送,然後顯示電子郵件後已成功發送etc..as

接觸形式processer代碼如下:

<?php 
$cardlink = $_POST['cardlink']; 
$howmuch = $_POST['howmuch']; 
$name = $_POST['name']; 
$email = $_POST['email']; 
$address = $_POST['address']; 
$phone = $_POST['phone']; 
$website = $_POST['website']; 
$comments = $_POST['comments']; 
$formcontent="Card Image Link: $cardlink \n How much cards: $howmuch \n From: $name \n Email: $email \n Address: $address \n Phone: $phone \n Website: $website \n Additinal Informations: $comments"; 
$recipient = "[email protected]"; 
$subject = "Card Designig Order By : $name "; 
$mailheader = "From: $email \r\n"; 
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); 
// Email has sent successfully, echo a success page. 
echo "<fieldset>"; 
echo "<div id='success_page'>"; 
echo "<h1>Email Sent Successfully.</h1>"; 
echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; 
echo "</div>"; 
echo "</fieldset>"; 
?> 

和火線觸點形式是在此鏈接:http://www.webngraphicssolutions.com/new_site/html_purple/web-contact-form-order-now/index.php

回答

0

您可以使用JavaScript的形式已提交給用戶重定向。

<script type="text/javascript"> 
    window.onload = function() { 
    window.location.href = "https://pilot-payflowlink.paypal.com/?MODE=TEST&SECURETOKENID=f976bec739fb40a5a0e48c1876d570e6&SECURETOKEN=7yVdfkdwbgkOzAg2h1vxHggvL"; 
    }; 
</script> 

在表單處理器發送的響應中輸出上面的代碼。

編輯: 由於形式是基於AJAX,並且希望在5秒鐘後重定向,這裏是修改答案:

把下面的代碼在你的Ajax成功處理程序。

window.setTimeout(function() { 
    window.location.href = "https://pilot-payflowlink.paypal.com/?MODE=TEST&SECURETOKENID=f976bec739fb40a5a0e48c1876d570e6&SECURETOKEN=7yVdfkdwbgkOzAg2h1vxHggvL"; 
}, 5000); 
+0

但我希望在5秒鐘後重定向..!也形式是基於ajax ..所以它不會加載時發送電子郵件發送成功後出現點擊發送我的意思是在subimitting之後,所以它會與JavaScript中的window.load函數.. –

+0

進一步檢查請檢查它現場在這個鏈接你會知道它不會加載submision:http://www.webngraphicssolutions.com/new_site/html_purple/web-contact-form-order-now/index.php –

+0

相應地修改我的答案。 – adesh

-1

使用setInterval函數

setInterval(function(){ 
    // Do something every 2 seconds 
}, 2000);