answersLogoWhite

0

You cannot call the print function from within PHP code. This is mainly because the PHP code is run server-side, and the printer is firmly part of the client's individual setup.

That said, you can use JavaScript to politely ask the browser to print the document. The call will cause the browser to bring up its default print dialog. The specific JavaScript method you're after is window.print();

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is syntax in php?

We can use php tags in different ways. <?php //php code to be written here ?> OR <? //php code ?> This tag will not work when we using editors such as macromedia dreamweaver. OR < script language="php"> //php code </script>


Why you do not see any PHP code when you view the source code of a PHP page in the browser?

PHP is server-side, the browser itself does not interpret it. Rather, the browser sends a query to the server, and the PHP scripting generates custom HTML document. It is this HTML that you are seeing the source code of.


How do you run a PHP script?

You run a PHP code using the following code.The code above will display the text Hello world in a HTML document.


Write down a PHP code to add a session variable?

The preferred way is to simply alter the session superglobal. <?php $_SESSION['variable'] = "value"; ?>


How do you use PHP in HTML?

You can't use PHP in an HTML document, but you can use HTML in PHP script.


How does a web server determine whether a requested document includes PHP code?

Web server passes the requested document to PHP interpreter, which validates and processes PHP code in it, then the server reads the response from PHP interpreter and returns the resulting response to client.For an instance, Apache HTTPD uses instructions such as AddType, to know how to process various documents, basing on their extensions (the following example is common and may require changes depending on Apache HTTPD and PHP configuration):AddType application/x-httpd-php .php .p8p .txtThis directive instructs Apache HTTPD to let PHP process files which are suffixed with .php, .p8p or .txt, thus files such as index.php, Homepage.p8p and Settings.txt will be processed by PHP.


What are PHP packages?

PHP packages are like modules you can add to PHP to add functionability. Adding new packages will allow you do do new things in your PHP scripts.


How can you put PHP into your product details pages?

<?php // your php code goes here ?> If your product pages are created in PHP (have the .php extension) then you can simply add the php start/end tag. There is a way to have the server recognize PHP inside of HTML files but that would require some work on the server, better left to the server manager.


What are semantics in PHP?

PHP is related with HTML. HTML can be included into PHP script as well as PHP script can be included into HTML code. PHP begins and ends with <?php ?>. PHP is mix of few languages so semantics is mixed too.


How do you create documents like configuration php?

All you need is a text editor, such as "notepad". When you save a document, you simply add an extension - for example ".php" - to the end of the filename and make sure that the file type selected is "all files" ("*.*").


How do you change the language code in a PHP page?

I have little idea of your question however <?php #code in here ?> is the starter for PHP, and then anything outside is HTML.


How do you compile php code?

To compile PHP code, you do not use a traditional compiler like you would with languages such as C++ or Java. PHP is an interpreted language, meaning the code is executed directly by the PHP interpreter. To run PHP code, you need a web server with PHP installed, such as Apache or Nginx. The PHP interpreter reads the code, processes it, and generates the output dynamically.