I am trying to write a piece of code that will allow detect a users browser type e.g. Opera, MSIE, Mozilla etc and output the relevant css link e.g:
opera = opera.css
MSIE = ie5.css
I am using the get_browser() function in the following script:
<?php
$browser = get_browser();
if ($browser = "Opera") {
$css = "op.css";
}
elseif ($browser = "MSIE") {
$css = "ie.css";
}
?>
the above script is stored in a file (css.php) and used as an include on the page to be processed:
<? include("includes/css.php")?>
the next line of coding on the page is:
<link rel="stylesheet" type="text/css" href="<? echo $css; ?>">
However this isnt working. The specific browser css file isnt displyed.
I am new to php and this is only the third script iv wrote, so i guess im missing something obviouse?
Dom