2013-06-24 39 views
1

基本上,我想讓用戶點擊一個PHP頁面上的按鈕,它將打印一個新的PHP頁面。這個功能工作。問題是我試圖將用戶標識轉移到第二頁並打印在新頁面上。然而,由於某種原因,這似乎正在迷失。在獲取請求之前,當我提醒用戶#時,會彈出#個提示。但是,當新的頁面出現在打印機對話框中時,userID缺失。任何建議將不勝感激。從PHP頁面1我的PHP獲取請求並不出現在請求的php文件

功能:

$("#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 [email protected]</div> 
     <div id="userID"> 
      <? echo UserID.$user = $_GET['userNow'] ?> 
     </div> 
    </div> 
</body> 

+0

試試這個當你打電話給你的iframe:'