Help - Search - Members - Calendar
Full Version: Setting Header/Footer dynamically in page
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
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.

Since you're using PHP, check out its include() function. That's probably what you are after.
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.
Darin McGrew
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.
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...
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.

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.
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
Christian J
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:
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.