Rookie9
Rookie9

Reputation: 57

"HTTP_USER_AGENT" not working. nothing is displayed in my browser i.e. firefox

<?php
$agent=getenv("HTTP_USER_AGENT");
if(preg_match("/MSIE/i", "$agent")){
    $result="You are using Microsoft Internet Explorer.";}
    else if (preg_match("/Mozilla/i", "$agent")){
    $result= "You are using Firefox.";}
    else {$result = " you are using $agent.";}

?>
<html>
<head>
<title>Browse Match Results</title>
</head>
<body>
<?php "<p>$result</p>";?>
</body>
</html>

Upvotes: 0

Views: 596

Answers (2)

Your Common Sense
Your Common Sense

Reputation: 157839

<?php echo "<p>$result</p>";?>

Upvotes: 0

Wrikken
Wrikken

Reputation: 70460

Might I venture a guess, and suggest that:

<?php "<p>$result</p>";?>

Should be:

<?php echo "<p>$result</p>";?>

Upvotes: 2

Related Questions