• 0

PHP Question


Question

i want aif statement like this: (because one of pagesi need to cahnge code to work in IE, and fix makes it looks badin other browsers

if (using-ie){

$page = page-ie.html;

}

else {

$page=page.html;

}

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Not sure if this will work since I have no way of testing it at the momment but try something like this...

<?php
$user_browser = get_browser (); 
if ( ( $user_browser->browser == "MSIE" ) )
 { 
 ? ?// code to redirect to IE page
 ? ?$page = page-ie.html;
 }
else
 {
 ? // Everything else goes to page.html
 ? $page=page.html;
 }
?>

Note user if is MSIE exactly but the function you should be looking for is get_browser IMO. Hope that helps you.

Edited by MAsKrA
Link to comment
Share on other sites

  • 0

this is my code

$browser = get_browser ();
	if ($browser->browser == "MSIE")
	{
   file = "page-ie.html";
	}
	else
	{
   $file = "page.html";
	}

it doesnt work. always gies the else, im in IE 6 btw

Link to comment
Share on other sites

  • 0

try this:

<?php

$browser = strpos($_SERVER['HTTP_USER_AGENT'], "MSIE");
if($browser)
{
	header("location: index_ie.html");
}
else
{
	header("location: index.html");
}
?>

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.