Jump to content

$_SERVER['HTTP_USER_AGENT'];


dejvmeditrade

Recommended Posts

Hello, please could you help me with my problem about PHP script? I need my program to detect user browser because html function 'type=''date'' '  is not

supported by SAFARI and IE. Please help me with this. Thanks :)

 

<?php
        function detect()
        {
         /*$info = $_SERVER['HTTP_USER_AGENT'];*/
         /* @var $_SERVER type */
         echo $_SERVER['HTTP_USER_AGENT'];
         $browser = get_browser();
         print_r($browser);
         if (\strpos($browser, 'IE') === true){
              echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]';
              echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';}
         else if (\strpos($browser, 'Safari') === true){
              echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]';
              echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';}        
         else{
            '<div class="w3-text-d1"><p><b>Dátum zákroku / Date of procedure</b></p></div>
            <p><input class="w3-input w3-border" type="date" required name="datum_zakroku"></p>';}
        }
        detect()
      ?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...