2013-03-01 39 views
2

我想在頁面的網址中添加類似'#coupon'的內容。誰能幫我?如何在頁面發佈到服務器後進入主頁

http://www.myhost.com/design-brief.php#coupon

<?php 
    if(isset($_POST['TryCoupon'])) 
    { 
     // I need something here 
     // I dont want to use Location to direct as I am on the same page and want to preserve field values 
    } 
?> 

我有我的頁面上的錨,我希望用戶當用戶提交表單去那。

<td id="coupon"></td> 
+0

你嘗試使用標題(「位置:http://www.myhost.com/wordpress/design-brief.php#coupon」); ?應該工作得很好。 – leafnode 2013-03-01 13:18:54

+0

否則,請嘗試使用普通的舊鏈接。 Hello! 2013-03-01 13:19:30

+0

您是否整合了jQuery,並且在提交它正在給定的url上? – 2013-03-01 13:19:55

回答

0
<?php 

if(isset($_POST['TryCoupon'])) 
{ 
    header("Location:place/your/url/here"); 
} 
?> 
1

變化形式的行動,包括錨:

<form method="post" action="/some/index.php#coupon"> 

這將張貼到/some/index.php並顯示頁面時,它會轉到錨太。

相關問題