2011-02-08 60 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会读取它。