answersLogoWhite

0

How do you add code for printing document in php code?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

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

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you add code for printing document in php code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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.


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 edit a PHP file?

Open it in Notepad. Add or remove whatever code you want. To test, you will have to upload it to a PHP enabled webhost, or you will need to install MySQL, PHP, and Apache on your computer. Use Editor to edit the PHP file. Example: Notepad++ , editplus ,Zend IDE ,Netbeans IDE


How do you create an area of a webpage to display PHP results?

PHP code blocks start with <?php and end with ?>.