ccrevcypsys Posted January 21, 2008 Share Posted January 21, 2008 I need to have an if statement like if -> ie 7 -> this if -> ie 6 -> this can i do this? Link to comment https://forums.phpfreaks.com/topic/87128-solved-how-do-i-set-the-if-to-chang-per-browser/ Share on other sites More sharing options...
teng84 Posted January 21, 2008 Share Posted January 21, 2008 you can try this $_SERVER['HTTP_USER_AGENT'] or this <a href="http://www.php.net/manual/en/function.get-browser.php">get_browser</a> Link to comment https://forums.phpfreaks.com/topic/87128-solved-how-do-i-set-the-if-to-chang-per-browser/#findComment-445621 Share on other sites More sharing options...
ccrevcypsys Posted January 21, 2008 Author Share Posted January 21, 2008 so how would i set it up in an if statement i have this but it isnt working echo $_SERVER['HTTP_USER_AGENT'] . "\n\n"; if($_SERVER['HTTP_USER_AGENT']=="Mozilla/4.0"){ echo "YES"; } Link to comment https://forums.phpfreaks.com/topic/87128-solved-how-do-i-set-the-if-to-chang-per-browser/#findComment-445632 Share on other sites More sharing options...
teng84 Posted January 21, 2008 Share Posted January 21, 2008 <?php $brwsr = explode(';',$_SERVER['HTTP_USER_AGENT']); $browser =trim($brwsr['1']); if( $browser== "MSIE 7.0"){ echo 'your using IE7'; } elseif($browser == 'MSIE 6.0'){ echo 'your using IE6'; } ?> you can also use get browser.. but its not working on my machine so i use user agent .. Link to comment https://forums.phpfreaks.com/topic/87128-solved-how-do-i-set-the-if-to-chang-per-browser/#findComment-445637 Share on other sites More sharing options...
ccrevcypsys Posted January 21, 2008 Author Share Posted January 21, 2008 thank you! Link to comment https://forums.phpfreaks.com/topic/87128-solved-how-do-i-set-the-if-to-chang-per-browser/#findComment-445649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.