2011-02-08 22 views
1

說我有info.php頁面與用戶信息(id,名稱,年齡等)。

在此頁面上,有一個'編輯'按鈕,用戶可以通過edit.php上的表單來更改他們的信息。表單通過帶有ID,名稱,年齡等的$ _POST進行填充。

edit.php有一個「更新」按鈕,該按鈕將更新後的數據發送回info.php。這一切工作正常。

但是,當我嘗試在jQuery Tools Overlay彈出窗口中加載edit.php時,將出現edit.php中的表單,但變量不會傳遞。相反,它們都顯示爲「未定義」。

我不確定在何處放置所需的href元素,以便在覆蓋圖內傳遞我的變量到edit.php

任何想法?

<form action="edit.php" method="post"> 
    <input type="hidden" name="edit" value="yes" /> 
    <input type="hidden" name="id" value="<?php echo $row[1] ?>" /> 
    <input type="hidden" name="name" value="<?php echo $row[2] ?>" /> 

<!-- this is the required href to trigger overlay --> 
    <a href="edit.php" rel="#overlay" style="text-decoration:none"> 

     <input type="submit" value="Edit"/> 

    </a> 

    </form> 

<div class="apple_overlay" id="overlay"> 

<!-- the external content is loaded inside this tag --> 
<div class="contentWrap"></div> 

</div> 

<!-- make all links with the 'rel' attribute open overlays --> 
<script> 

$(function() { 

    // if the function argument is given to overlay, 
    // it is assumed to be the onBeforeLoad event listener 
    $("a[rel]").overlay({ 

     mask: 'darkred', 
     effect: 'apple', 

     onBeforeLoad: function() { 

      // grab wrapper element inside content 
      var wrap = this.getOverlay().find(".contentWrap"); 

      // load the page specified in the trigger 
      wrap.load(this.getTrigger().attr("href")); 
     } 

    }); 
}); 
</script> 
+0

什麼是jQuery Tools Overlay?你在談論jQuery UI嗎?這個源代碼是edit.php還是? – macarthy 2011-02-08 03:33:02

+0

哦,jQuery工具流水遊戲... http://flowplayer.org/tools/index.html – macarthy 2011-02-08 03:41:41

回答

1

我對這個問題有點困惑,但是這可能是你在找什麼...

您需要可以通過ID在網址和查找數據服務器端或通過在url中的所有數據像這樣

<a href="edit.php?id=<?php echo $row[1] ?>&name="<?php echo $row[2] ?>" rel="#overlay" style="text-decoration:none"> 
0

另一種方法是存儲名稱ID和所有的東西在$ _SESSION在PHP中。然後info.php將它保存並編輯php會讀取它。