Please help me in the followig questions;
How to;

  • Print a specific form.
  • To set custome header and footer.
  • Goto other page, enter data from previous page and trigger a specific button on next page.


4 Years
Discussion Span
Last Post by akkbkht

Ok, two things as both of you don't seem to have read the rules of Daniweb.

Firstly towards akkbkht, please can you show us what you have done so far so we know which bit you are stuck on specifically. Daniweb isn't designed for people to do your homework on. In response to your question however, you would need to be looking at JavaScript if you want to implement a function that allows a person to print a webpage from your site (others they can just do it in their browser, or pressing the Ctrl + P keys).

Secondly to Wesley.cheek.96, you should start a new thread if you have a question as to avoid people getting confused, and please include some more detail.

Edited by Octet


Thanks @AHarrisGsy.
I am creating a web based managment system. I want to facilitate the user with print button which will open the print dialogue box. But I want that I should set the header and footer according to my choice. So that user just press print button on web page then print button on print dialogue box.

Here is the code

<button type="button" onClick="window.print();" >Print</button>

Here is the sample print put page. I dont want the text "Patient Record | New Patient | Doctor Record | Medicine Record" at the top. Submit button and Logout button at the end. And I want to set the header and footer by default through html or php.
Thanks and Regrads

Edited by akkbkht: Image is missing


And yes. I would like to also print an image (which is not inserted yet) in the top area of the table. This image will be about the name of the organization and address plus contact numbers.


What you need to do is have it link to a printer friendly document, whether with the viewer knowing or without.

You can either do this by literally changing the page to one which includes what you want and doesn't include what you don't want, or you can change the CSS, print it and then change it back.

Good luck.


Still confused in the point.

I have printed a page on testing basis, it prints page title, and page address in header and page number lus date n time in footer. How can i control it. Please eleborate with an example.


Going back to my previous answer, you need to setup a printer friendly document. The JavaScript print function shall print the page in the same way as pressing Ctrl + P, which means anything that is seen on the screen shall be sent to the printer.
This means that you could be printing a very colourful, and thus expensive document which contains things you don't want as you've discovered.

To resolve this issue, you can do one of two things. When you click the button which shall print it you can either swap your CSS for one which removes the colours, and hides certain elements or you can copy the relevant data (such as the main article) onto a seperate HTML page and print that. Once you've sent it to the printer you are going to want to then redirect the browser back to the original page so that the user shall be none the wiser.

Does that make sense?

Votes + Comments
Nice explanation
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.