How To create automatic print?

Posted on 2005-04-05
Last Modified: 2008-03-06

Please help me if u know how to answer this problem.

i'm going to make a print page for others file in php. i create others file name print.php, then in print.php, i try include files that i wanna print.

but i got a trouble when i use include("http://....."), couse, it seem that the session doesn't declared yet. so, if i try the print.php, we have to login again, then we can not print the page

if i just use include("....") theres not http, it can't be, it got error couse i try use multiple variable request.

i used session on login script. any others the way to make print page in php? or please solve my problem, thanks

function printPage() {
    if (window.print) {
        agree = confirm('Print Halaman Ini?');
        if (agree) window.print();

<body OnLoad=printPage()>



Question by:abdi1
    LVL 8

    Accepted Solution

    Hmmm... not quite clear what you are trying to do here. When including a file, you extend your current scope with it. So every variable that is declared at that moment is available in your included code; so kiri.php should be able to use $halaman, $aksi, $menu etc. So there would be no need to use the http:// for including that file. If you still need it for some other reason, you probably will need to pass the correct PHPSESSIONID to the kiri.php file. You can do this just like you did the other variables (use session_name() to get the name of your current session and session_id() to get the current session id)
    LVL 7

    Assisted Solution

    <script language="JavaScript">
    LVL 14

    Expert Comment

    This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

    It is assumed that any participant not responding to this request is no longer interested in its final deposition.

    If the asker does not know how to close the question, the options are here:

    EE Cleanup Volunteer
    LVL 14

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave the following recommendation for this question in the Cleanup topic area:
    Split: Promethyl & _Marcel_

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now