fixxxer Posted October 21, 2007 Share Posted October 21, 2007 hi, ive just built a new menu for a site of mine. it works fine in firefox but in IE it doesn't, ive been told that because my code is :- <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'> ....etc that this causes internet explorer to enter some sort of quirks mode and render the page differently. my problem is that i also thought the session_start has to be the first line. is there a way for me to combine them both and ensure IE displays page as firefox does. ive been trying for two days to resolve it but am having no luck thanks Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/ Share on other sites More sharing options...
only one Posted October 21, 2007 Share Posted October 21, 2007 I'm sorry but unless you are printing anything in that PHP code it shouldn't cause any problems, it's proboally just your HTML or CSS. My website being a perfect example of it working fine. Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/#findComment-374901 Share on other sites More sharing options...
fixxxer Posted October 21, 2007 Author Share Posted October 21, 2007 it only causes a problem when i put session_start(); above the html doc declaration like in the example in the first post but if i just have code in there like :- <?php echo 'test'; $var = 'test'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'> etc.. this will load the menu fine, but as soon as i put session_start(); in there the menu doesn't work. theres nothing wrong with the code becuase it works in firefox fine and the problem only occurs if i put in session_start(); in the php section above the header. has anybody every had a problem like this? I found other posts on the net of people who have similar problems but no solution. it might be becuase im not very good then. but can i then ask how users on here start their pages. ive always done mine as :- <?php //php code ?> <html .... with the doctype here. is this right Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/#findComment-374908 Share on other sites More sharing options...
only one Posted October 21, 2007 Share Posted October 21, 2007 That's impossible.. A simple session_start() funcion can't write any HTML to the document. I make my page, one with php and the index page, I then include the php page on the top of the index page and let the php page set the values of the varuabls too be shown on the index page. Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/#findComment-374912 Share on other sites More sharing options...
fixxxer Posted October 21, 2007 Author Share Posted October 21, 2007 thanks. dont know whats causing it. its not that the session_start(); is writing anything to the page but that i was under the impression that IE need the DOCTYPE declaration needs to be at the top and for some reason when i put session_start in it causes IE to go into quirks mode and so doesn't read the css correctly. when i leave the session_start() out the page displays fine and the drop down menu works. but when it goes back in i get an error. Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/#findComment-374916 Share on other sites More sharing options...
chronister Posted October 21, 2007 Share Posted October 21, 2007 PHP will NEVER make IE break a page and FF render it correctly. PHP is server side and unless your echoing something out, it is strictly on the server and not on the client.c 99% of the time, when IE gets stupid its because of CSS or bad HTML Nate Quote Link to comment https://forums.phpfreaks.com/topic/74219-php-above-causes-ie-to-enter-quirks-mode/#findComment-374932 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.