我的php get请求没有出现在请求的php文件中

时间:2013-06-24 05:43:45

标签: php html get

基本上,我试图让用户点击一个php页面上的按钮,它将打印一个新的php页面。这个功能工作。问题是我试图将用户ID转移到第二页并打印在新页面上。然而,出于某种原因,这似乎正在迷失。当我在获取请求之前立即提醒用户#时,会显示#个弹出窗口。但是当新页面出现在打印机对话框中时,缺少userID。任何建议都将不胜感激。

php第1页的功能:

$("#printing").on('click',function(){
    alert (user);
    $.get("flyer.php", {userNow: user});                
    $('body').append('<iframe src="flyer.php?userNow" id="printIFrame" name="printIFrame"></iframe>');
    $('#printIFrame').bind('load', 
        function() { 
            window.frames['printIFrame'].focus(); 
            window.frames['printIFrame'].print(); 
        }
    );
});

php第2页:

<html>
<body>
    <div class="wrapper">
        <h1>Tai Chi</h1>

        <h2>Sign Up Now!</h2>

        <h3>Benefits of Tai Chi:</h3>
        <ul>
            <li>It enhances harmony between body and mind</li>
            <li>It improves your internal energy level</li>
            <li>Improves your muscle strength and endurance</li>
            <li>Reduces back pain</li>
            <li>Lowers daily stress</li>
            <li>Can slow down the aging process</li>
        </ul>
        <div id="contact">For more information, please email R-adler@neiu.edu</div>
        <div id="userID">
            <? echo UserID.$user = $_GET['userNow'] ?>
        </div>
    </div>
</body>

2 个答案:

答案 0 :(得分:0)

GET数组中没有传递任何值。

将链接用作flyer.php?userNow="+user

答案 1 :(得分:0)

尝试连接用户值,如下所示:

$("#printing").on('click',function(){
alert (user);                 
$('body').append('<iframe src="flyer.php?userNow='+user+'" id="printIFrame" name="printIFrame"></iframe>');
$('#printIFrame').bind('load', 
    function() { 
        window.frames['printIFrame'].focus(); 
        window.frames['printIFrame'].print(); 
    }
);
});

如果你在那里传递user值,也请检查网址。