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

How To create automatic print?

Hallo,

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

print.php:
<?
include("config.php");
?>
<html>
<head>
<SCRIPT LANGUAGE=JavaScript>
<!--
function printPage() {
    if (window.print) {
        agree = confirm('Print Halaman Ini?');
        if (agree) window.print();
    }
}
//-->
</script>

</head>
<body OnLoad=printPage()>

<?
$halaman=$_REQUEST[halaman];
$aksi=base64_decode($_REQUEST[aksi]);
$menu=base64_decode($_REQUEST[menu]);
$proses=base64_decode($_REQUEST[proses]);
$hal=base64_decode($_REQUEST[hal]);
$sorting=base64_decode($_REQUEST[sorting]);
$namakantor=base64_decode($_REQUEST[namakantor]);
$sort_order=base64_decode($_REQUEST[sort_order]);
$status=base64_decode($_REQUEST[status]);
$tahun_input=base64_decode($_REQUEST[tahun_input]);

include("http://192.168.0.1/web/kiri.php?aksi=$aksi&menu=$menu&proses=$proses&hal=$hal&sorting=$sorting&namakantor=$namakantor&sort_order=$sort_order&status=$status&tahun_input=$tahun_input");
?>

</body>
</html>
0
abdi1
Asked:
abdi1
  • 2
2 Solutions
 
_Marcel_Commented:
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)
0
 
PromethylCommented:
<script language="JavaScript">
window.print();
</script>
0
 
hujiCommented:
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:
http://www.experts-exchange.com/help.jsp#hs5

Huji
EE Cleanup Volunteer
0
 
hujiCommented:
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.

Huji
EE Cleanup Volunteer
0

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