php detect web browser

<?php
$useragent = $_SERVER[‘HTTP_USER_AGENT’]);

if (preg_match(‘|MSIE ([0-9].[0-9]{1,2})|’,$useragent,$matched)) {
    $browser_version=$matched[1];
    $browser = ‘IE’;
} elseif (preg_match( ‘|Opera ([0-9].[0-9]{1,2})|’,$useragent,$matched)) {
    $browser_version=$matched[1];
    $browser = ‘Opera’;
} elseif(preg_match(‘|Firefox/([0-9\.]+)|’,$useragent,$matched)) {
        $browser_version=$matched[1];
        $browser = ‘Firefox’;
} elseif(preg_match(‘|Safari/([0-9\.]+)|’,$useragent,$matched)) {
        $browser_version=$matched[1];
        $browser = ‘Safari’;
} else {
        // browser not recognized!
    $browser_version = 0;
    $browser= ‘other’;
}

print “browser: $browser $browser_version”;
?>

Show / Hide a table with Javascript

<script type="text/JavaScript">

<!--
function show(id)
{
     if (document.getElementById(id).style.display == 'none')
     {
          document.getElementById(id).style.display = '';
     }
}
//-->

<!--
function hide(id)
{
          document.getElementById(id).style.display = 'none';

}
//-->
</script>


<table cellspacing="1" cols="3" border="0">
    <tbody>
    <tr valign="top" align="left">
      <td width="202"><b>Please, select option</b></td>

      <td width="481">A
        <input type="radio" name="Option" onfocus="hide('tblB');hide('tblC');show('tblA');">
        B
        <input type="radio" name="Option"  onfocus="hide('tblA');hide('tblC');show('tblB');return true;">
        C      
        <input type="radio" name="Option" onfocus="hide('tblA');hide('tblB');show('tblC');return true;">
      </td>
    </tr>
    </tbody>
  </table>
  

  <table id="tblA" style="DISPLAY: none" cols="1" cellpadding="2">
    <tbody>
    <tr valign="top" align="left">
     
    <td>
      You&nbsp;select A,
      table
      tblA is shown&nbsp;
      </td>
    </tr>
    </tbody>
  </table>
  <table id="tblB" style="DISPLAY: none" cols="1" cellpadding="2">
    <tbody>
    <tr valign="top" align="left">
      <td>
       You&nbsp;select B, table tblB
       is shown&nbsp;
      </td>
    </tr>
    </tbody>
  </table>
   <table id="tblC" style="DISPLAY: none" cols="1" cellpadding="2">
    <tbody>
    <tr valign="top" align="left">
      <td>
       You&nbsp;select C, table tblC
       is shown&nbsp;
      </td>
    </tr>
    </tbody>
  </table>