我的php get请求未出现在请求的php文件中
基本上,我试图让用户点击一个php页面上的按钮,它将打印一个新的php页面。这个功能有效。问题是我正在尝试将用户ID转移到第2页并打印到新页上。然而,出于某种原因,这似乎正在消失。当我在get请求发出之前提醒用户时,会弹出显示。但当新页面出现在打印机对话框中时,用户ID丢失。如有任何建议,将不胜感激 php第1页中的函数:我的php get请求未出现在请求的php文件中,php,html,get,Php,Html,Get,基本上,我试图让用户点击一个php页面上的按钮,它将打印一个新的php页面。这个功能有效。问题是我正在尝试将用户ID转移到第2页并打印到新页上。然而,出于某种原因,这似乎正在消失。当我在get请求发出之前提醒用户时,会弹出显示。但当新页面出现在打印机对话框中时,用户ID丢失。如有任何建议,将不胜感激 php第1页中的函数: $("#printing").on('click',function(){ alert (user); $.get("flyer.php", {userNow
$("#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>
GET数组中没有传递值
将链接用作flyer.php?userNow=+user尝试如下连接用户值:
$("#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();
}
);
});
如果您将uservalue传递到了url中,请也检查url。在调用iFrame时尝试此操作:@Sergio,谢谢您的建议,但此操作无效。您是否删除了$.getflyer.php,{userNow:user};当两个问题都回答“是”时。如果您查看第二个php页面中的代码,您会注意到html底部的php代码片段。对于第一个,如果我删除get,我想我也会从第二个php页面中删除它