0

将值从“索引”页面传递到 SimpleModal 演示联系表的最简单方法是什么?例如,如果用户已登录并且他们的电子邮件地址存储在变量 $email 中,那么在演示联系表中提供该信息的最直接方法是什么?

谢谢你。

4

1 回答 1

0

假设您想要的值不在表格中,这是一种方法。

更新函数中的contact.js onShow:

...
}, function () {
    $('#contact-container .contact-loading').fadeIn(200, function () {

        var pt = PAGE_TITLE,
            aid = ARTILE_ID;

        $.ajax({
            url: 'data/contact.php',
            data: $('#contact-container form').serialize() + '&action=send&page_title=' + pt + '&article_id=' + aid,
            type: 'post',
            cache: false,
            dataType: 'html',
            success: function (data) {
                $('#contact-container .contact-loading').fadeOut(200, function () {
                    $('#contact-container .contact-title').html('Thank you!');
                    msg.html(data).fadeIn(200);
                });
            },
            error: contact.error
        });
    });
});
...

function smcf_send()然后更新函数中的contact.php

...
// Set and wordwrap message body
$pt = isset($_POST["page_title"]) ? $_POST["page_title"] : "";
$aid = isset($_POST["article_id"]) ? $_POST["article_id"] : "";

$body = "From: $name\n\n";
$body .= "Page Title: $pt\n";
$body .= "Article ID: $aid\n\n";
$body .= "Message: $message";
$body = wordwrap($body, 70);
...

显然你可以玩弄细节,但这应该能让你继续前进。

-埃里克

于 2010-07-15T20:42:12.130 回答