Jump to content

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/73805-includes/
Share on other sites

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)
Link to comment
https://forums.phpfreaks.com/topic/73805-includes/#findComment-372337
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/73805-includes/#findComment-372340
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/73805-includes/#findComment-372349
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.