• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

How To create automatic print?


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()>



  • 2
2 Solutions
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)
<script language="JavaScript">
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
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now