FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


browser info in a form





ftv_flung
How do I echo browser information in a form?

I just want to collect info about what browser is being used, version etc., possibly OS, resolution etc. and put this into a form so it sends browser info with the stuff they submit anyway.
imagefree
alternatively, why no the get the info from the page submitted. These is no need to first place this info into form and then send it to server. When the request is made to server, you can get the desired info, how? See below.


Code:


<?php
$browser_name="Unknown";
$agent = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$agent"))
{
   $browser_name = "IE";
}

else if (preg_match("/Mozilla/i", "$agent"))
{
   $browser_name= "Netscape";
}
//the $browser_name variable now has the browser name. Someone else may be help you in detail.
?>


You can get browser name, version, OS, but cant get Screen resolution with php. i think you need to do it which javascript.
mahirharoon
imagefree wrote:
alternatively, why no the get the info from the page submitted. These is no need to first place this info into form and then send it to server. When the request is made to server, you can get the desired info, how? See below.


Code:


<?php
$browser_name="Unknown";
$agent = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$agent"))
{
   $browser_name = "IE";
}

else if (preg_match("/Mozilla/i", "$agent"))
{
   $browser_name= "Netscape";
}
//the $browser_name variable now has the browser name. Someone else may be help you in detail.
?>


You can get browser name, version, OS, but cant get Screen resolution with php. i think you need to do it which javascript.

use instead
Code:
<?php
//echo user agent
echo "$_SERVER['HTTP_USER_AGENT']";
?>

edit :
Quote:
why are you pming me for questions , post here so other users would get help from that
Related topics
[java scripts] Text effect , img ....
PHP: Feedback form issues.. help =P
751 Useful Windows XP Files
AJAX tutorial
How to access CPanel/DirectAdmin from behind a firewall
Cpanel Acess... again!
Programming links, info, and tutorials
form button to open a custom sized new window
iframe
MAKE YOUR OWN WEB BROWSER
Google Analytics
Old browser compatibility.
help getting form info into mysql db
Bulk file upload form a web browser?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.