thefollower Posted October 18, 2007 Share Posted October 18, 2007 If you have an include with a menu in that include lets say. So then when you type the include on to the page the menu will load up. Well that is what i done but its screwed up my pages. I'm trying to load up a page and the include does load up the information from the include but then any html on the main php script that the include is part is not showing =/ What can cause this ? Also how can i get around a header situation if the html is loaded via includes and the header wants to change the page ? Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/ Share on other sites More sharing options...
cmgmyr Posted October 18, 2007 Share Posted October 18, 2007 Can you include you code here? and maybe a live link to a site showing us? Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/#findComment-372333 Share on other sites More sharing options...
thefollower Posted October 18, 2007 Author Share Posted October 18, 2007 Well i dont have a live link but this is what i have as an example: include has : //connect etc etc If ($Jail == 1) { Header ("Location: britishjail.php"); }Else{ Echo '<body bgcolor="#466B98" text="#000000" style="scrollbar-face-color:#C8E8F8;scrollbar-arrow-color:#000000;scrollbar-3dlight-color:#C8E8F8;scrollbar-darkshadow-color:#404040;scrollbar-highlight-color:#E8F4FF;scrollbar-shadow-color:#40B0E8;scrollbar-track-color:#E8F4FF;"> <img src="Banner1.jpg" id="Image1" alt="" align="top" border="3" width="1000" height="50" style="position:absolute;left:0px;top:0px;width:994px;height:94px;border-color:#FFFFFF;z-index:0"> Then a script would have: <?php include ("homeloginvariables.php"); //code bleh if something == true then { header ("location: blah.php");} Else{}; ?> And i get this: <b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\include.php:67) Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/#findComment-372337 Share on other sites More sharing options...
MadTechie Posted October 18, 2007 Share Posted October 18, 2007 header must be sent before anything is sent to the page.. so like this <?php if ($something == true) { header ("location: blah.php");} }else{ //code bleh include ("homeloginvariables.php"); } ?> if its the start of the code, see the pinned post about headers Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/#findComment-372340 Share on other sites More sharing options...
thefollower Posted October 18, 2007 Author Share Posted October 18, 2007 Yeh that idea you gave would make sense but the html in the include also contains the general connect to the entire database so without it being first nothing will work in terms of queries etc and i cant use an if something all the time cos all the include has is connect and it loads the menu which has simple navigation stuff.. ill take a read again.. wasn't sure what part of the pinned topic was relating to my problem. Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/#findComment-372349 Share on other sites More sharing options...
MadTechie Posted October 18, 2007 Share Posted October 18, 2007 why do you need the connection to the database if your redirecting to another page? Quote Link to comment https://forums.phpfreaks.com/topic/73805-includes/#findComment-372360 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.