tags:

views:

49

answers:

1

I have a page where I want to display a form if the user clicked the url for that page, and well... This script below works totally fine in Firefox and Opera, but Internet Explorer (6 in my case) just shows a blank page. Although, when I refresh after visiting the page, it shows up fine. Deleting cookies etc from the browser doesn't solve anything..

<?php session_start(); ?>
doctype, htmltag, headtag etc etc...
<?php if($_GET['do'] == 'whatever') { ?>
Content for ?do=whatever...
End htmltag etc etc...
<?php exit; } // Then end the script, because we don't want to display more content for ?do=whatever ?>

...Content to display if no action was set...

I also noticed that once I removed session_start(); from the script, it worked fine in IE. Any help is appreciated!

+1  A: 

Try removing the Content-Type and Content-Language (if you use it) meta tags from the HTML, and put them directly in your PHP before or after the session start.

header('Content-Type: text/html; charset=UTF-8'); 
header('Content-Language: en-us');

I realize this doesn't look like it makes a lot of sense, but then again IE rarely makes much sense :)

I remember using it in a similar situation a while ago, involving gzip encrypted requests, using PHP sessions, being shown blank in IE6. The same solution may apply here. I never found out why it had worked, but it worked.

Atli
Ah, the mystery has been solved! Thanks a ton for your help. Editing out the meta tag was enough for it to work properly in IE, so it was all the meta-tags fault :)
Nisto