Petty_Crim Posted April 11, 2008 Share Posted April 11, 2008 I am getting this weird error with Internet explorer when I try viewing my php page. The page works 100% fine in Firefox but IE doesn't like it oddly. The page itself does not use any XML that I know of so I have no idea why I get this error. The IE debugger says the following: xml documents cannot contain multiple root level documents I am using php include in the page could this be the problem? I am also adding a link to a css file and a js file at the end of the page outside of the php. The page doesn't seem to be loading the javascript or css files so I am thinking it might be something to do with their positioning, it works fine in Firefox but IE doesn't seem to load them at all. This is how my page is setup: <?php include 'content.php'; ?> <script src="js_file.js"></script> <link rel="stylesheet" type="text/css" href="css_file.css" /> Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 11, 2008 Share Posted April 11, 2008 Could you post a link to it? Quote Link to comment Share on other sites More sharing options...
haku Posted April 11, 2008 Share Posted April 11, 2008 What doctype are you using? And what mime-type are you using? I would guess that you are using an XHTML doctype and an application/xhtml+xml mime type. IE doesn't recognize this mime type. Quote Link to comment Share on other sites More sharing options...
Petty_Crim Posted April 11, 2008 Author Share Posted April 11, 2008 Could you post a link to it? The link to it is here: (any id num works) http://www.btk.tfcph.com/x/signup.php?id=100 Quote Link to comment Share on other sites More sharing options...
Petty_Crim Posted April 11, 2008 Author Share Posted April 11, 2008 What doctype are you using? And what mime-type are you using? I would guess that you are using an XHTML doctype and an application/xhtml+xml mime type. IE doesn't recognize this mime type. I am not using any doctype/mime-type if that makes sense. I don't have the line that says the doc type / mime-type cause I am using php. I've never bothered with that stuff does it make a difference? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 11, 2008 Share Posted April 11, 2008 You're missing a doctype, an html element and a body element. You can validate your markup here: http://validator.w3.org/ Quote Link to comment Share on other sites More sharing options...
haku Posted April 11, 2008 Share Posted April 11, 2008 I am not using any doctype/mime-type if that makes sense. I don't have the line that says the doc type / mime-type cause I am using php. I've never bothered with that stuff does it make a difference? Yes, it makes a big difference. Although that is probably not what is causing your problems this time. You are using (x)html whether you realize it or not. PHP is simply the tool you are using to output your (x)html. So PHP is the tool, and (x)html is the product. If you don't have a doctype and a mime-type, then browsers have to take a wild guess at what kind of (x)html you are using. Each browser will guess differently, meaning that its a wild guess as to how your page will look in the different browsers. A doctype is necessary to tell the browser exactly what type of code you are giving it, then you have to make your code conform to that datatype. You should really have learned all this stuff before starting PHP. Its like practicing cooking without knowing anything about the ingredients you are using. Whatever you get is going to be unreliable, and if it turns out ok, its going to be pure luck. Quote Link to comment Share on other sites More sharing options...
Petty_Crim Posted April 11, 2008 Author Share Posted April 11, 2008 That validate thing says "This page is not Valid (no Doctype found)!" Anyone know what doc type I should use also how do you know what one to use? Quote Link to comment Share on other sites More sharing options...
Petty_Crim Posted April 11, 2008 Author Share Posted April 11, 2008 Ok i have set it to: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Is that ok for XML? Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 11, 2008 Share Posted April 11, 2008 No, that's an HTML doctype. Quote Link to comment Share on other sites More sharing options...
haku Posted April 11, 2008 Share Posted April 11, 2008 But seeing as you said you aren't using XML, that's probably a good doctype to start with. Use it, then validate your code, and fix the mistakes that come up. Quote Link to comment 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.