PDA

View Full Version : printing a PHP form without a header


Grimbold7
07-29-2015, 07:55 PM
Hi all,
I am a newcomer to web building as our club needed a volunteer to run an existing website. my question is - how do I remove a css rule from a single page so as not to effect the rest of the webpages, members enter our annual comps on line through a data base and our comps secretary prints them off but as the whole page is printing including the header and php menu bars he cannot get it all on one page but he could if I can stop it printing the unwanted elements.
Any help please would be appreciated
Grimbold7

edbr
07-30-2015, 02:04 AM
Hi , first welcome to the forum.
how do I remove a css rule from a single page so as not to effect
there area few ways to do this, css rule specific to page( <body> ) id.
an on line style in the head using an !important might work.


as you are concerned about printing then a media call or a seperate print media sheet with display;none on the unwanted items.
@media print {

}

if you give a web address we can have a look for you

Grimbold7
07-30-2015, 03:56 PM
Thanks for your quick response, I will give you the URL of the club - www.woodburywoodturners.org.uk (http://www.woodburywoodturners.org.uk)
I don't know how much help that will be for you as the print form is not on it and members have to log in to get the competition menu. would it help if I let you have the css style coding that is attached to the print form page ?

edbr
07-31-2015, 01:08 AM
no thats ok. might need code for the page but try this first, add to your style sheet

@media print {
#navcontainer,footer{display:none:}
}

edbr
07-31-2015, 01:10 AM
BTW on the index page you have around line 71-75

<div id="navcontainer">
</div>

<div id="navcontainer">
</div>

delete them, they do nothing and you can only have 1 instance of an id on a page
i just checked thay are on other pages too

Grimbold7
07-31-2015, 04:13 PM
Thanks again for your advice, I have looked at the said lines in the "view source" for the index page but when I look at the same code in DW it looks like this -
else {include ('../includes/menu11.php'); }?>
</div>
<div id="navcontainer">
<?php if (isset($data)) {include ('../includes/menu2.php'); } ?>
</div>

<div id="navcontainer">
<?php if (isset ($data['id']) && $data['id'] == '666'){include ('../includes/menuadmin.php'); }?>
</div>
so do you still think it is safe to remove them ?
If I do will it help with the print form problem that I am trying to overcome ?
Thanks again

edbr
08-01-2015, 12:53 AM
thats just bad coding. it will create multiple navigation divs
not knowing the conditions i will only be able to give a best guess but 1 way, based on the cose you show would be
<body><div id="navcontainer">
<?php if (isset($data)) {include ('../includes/menu2.php'); }
elseif (isset ($data['id']) && $data['id'] == '666'){include ('../includes/menuadmin.php'); }
?>
</div>

etc and add the other include in that

edbr
08-01-2015, 01:02 AM
another way would be leave the conditions as is but remove the
<div id="navcontainer">
....
</div> tags but add them at start and finish of the included files