1

info.phpユーザー情報(ID、名前、年齢など)を含むページがあるとします。

このページには、ユーザーがedit.php情報を変更できるフォームに移動する「編集」ボタンがあります。フォームには、ID、名前、年齢などの $_POST を介して入力されます。

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

もう 1 つの方法は、名前 ID とそのすべてを PHP の $_SESSION に格納することです。次に、info.php がそれを保存し、edit php がそれを読み取ります。

于 2011-02-08T14:01:18.013 に答える