开发者

jQuery Tools Overlay - Loading form but not passing $_POST vars?

Say I have info.php page with user info (id, name, age, etc).

On this page, there is an 'edit' button that takes the user to a form on edit.php so they can change their info. The form is populated via $_POST with id, name, age, etc.

edit.php has an 'update' button that posts back to info.php with the updated data. This all works fine.

But when I try to load edit.php within a jQuery Tools Overlay pop-up, the form in edit.php appears but the variables are not passed along. Instead they all appear as 'undefined'.

I am not sure where to place the required href element so as to pass my variables to edit.php when inside the overlay.

Any ideas?

    <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>


I'm a little confused by the question but this is possibly what you are looking for...

You need to either pass the ID in the url and look up the data serverside or pass all the data in the url like so

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


Another way is to store name id and all that stuff in $_SESSION in php. Then info.php would save it and edit php would read it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜