1

假设我有info.php包含用户信息(id、姓名、年龄等)的页面。

在此页面上,有一个“编辑”按钮,可将用户带到一个表单,edit.php以便他们可以更改他们的信息。该表单通过 $_POST 填充 id、姓名、年龄等。

edit.php有一个“更新”按钮,可以info.php用更新的数据发回。这一切都很好。

但是,当我尝试edit.php在 jQuery Tools Overlay 弹出窗口中加载时,会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>
4

2 回答 2

1

我对这个问题有点困惑,但这可能是你正在寻找的......

您需要在 url 中传递 ID 并在服务器端查找数据,或者像这样传递 url 中的所有数据

<a href="edit.php?id=<?php echo $row[1] ?>&name="<?php echo $row[2] ?>" rel="#overlay" style="text-decoration:none">
于 2011-02-08T03:36:24.623 回答
0

另一种方法是将名称 id 和所有这些东西存储在 php.ini 中的 $_SESSION 中。然后 info.php 将保存它并编辑 php 将读取它。

于 2011-02-08T14:01:18.013 回答