Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Setting Header/Footer dynamically in page

Posted by: SteveD Aug 21 2007, 08:44 PM

I'm trying to print web-based forms, some of the forms are more than one page so I would like some basic, identifying information to be displayed in a header or footer on the pages. I don't know where the browser is going to do a page break as the forms can be varying lengths depending on how much text users enter.

Is there any way to set the text in a header/footer? I'm generating my html with a php script, running on a Windows server.


Posted by: Peter1968 Aug 21 2007, 09:04 PM

Since you're using PHP, check out its include() function. That's probably what you are after.

Posted by: SteveD Aug 21 2007, 09:50 PM

QUOTE(Peter1968 @ Aug 21 2007, 09:04 PM) *

Since you're using PHP, check out its include() function. That's probably what you are after.

I don't understand, Include() will include a file, I'm not sure how that will happen at the top or bottom of every printed page. Maybe at the top or bottom of the html page, but when I print I would like pages 2, 3, 4, etc., to have the user's name displayed so the administrator printing these forms doesn't get the pages mixed up.

Posted by: Darin McGrew Aug 21 2007, 09:50 PM

I don't think that's what SteveD is looking for. I think he's looking for a way to put a common header/footer on each printed page.

I don't know of a way to do what he wants to do.

Posted by: garrettstj Aug 21 2007, 09:57 PM

This sounds like more of an issue with a browser setting than a scripting/coding issue. You can change headers/footers in your browser before printing:

--- IE 7 ---
1. File > Page Setup...
2. Make modification to Header and Footer
a. It appears that &p represents current page and &P represent total pages

--- FF 2 ---
1. File > Page Setup...
2. Go to the 'Margins & Header/Footer' tab
3. In the 'Headers & Footers' section select the information you would like to display.

Hope this is what you are aiming for help on...

Posted by: SteveD Aug 21 2007, 10:15 PM

No, I'm trying to print html forms from data in a database. So if there are 5 entries in the database I'll get 5 forms printed out. I have an html formatted form so I get one long listing on the computer monitor, which is ugly, but printed out the administrator will get these nicely laid out paper forms.

Since each form may be 2 or more pages long, I'd like to have a unique identifier at the top or bottom of each printed page just to keep them all organized. I was hoping there was a simple CSS or html type of a setting/tag that would change the browser header/footer, or display a text string at every page break.

Posted by: garrettstj Aug 22 2007, 12:38 AM

Ahh....I understand now. Well, I'm with Darin...I've never seen anything like this. The issue is that the browser is the one deciding the page breaks, but by then it is too late to do anything with CSS.

Posted by: pandy Aug 22 2007, 02:45 AM

Is this an inhouse thing? That is, can you control what browser will be used to print out the forms? because if you can avoid MSIE I think it's possible.

If you have a useable TITLE that identifies the form you can make the title visible on the page by making HEAD and TITLE 'display: block'. Or you could use generated content.

body:before   { content: "My Unique Identifier" }

How to get the identifiers in there is another problem. tongue.gif

Posted by: Christian J Aug 22 2007, 06:54 PM

You might use a table, since some browsers let THEAD and TFOOT elements repeat on each new paper:

Another idea might be to let CSS control where a page should be broken, and add the "identifying information" there:

Posted by: SteveD Aug 22 2007, 10:00 PM

The <THEAD> works great with Firefox, no go with IE 7. It's an internal application and I know the two users of the program. One uses Firefox, the other I'm not sure - I'll persuade her to use Firefox!!

Thanks for the help - I learn something new every day.

Powered by Invision Power Board (
© Invision Power Services (