I am new to PHP and could use any help I can get. I am getting two errors with the code below:

1) Unexpected character in input: '\' (ASCII=92) state=1

2) syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Both in like 21, which is $error line... any help would be amazing.

Thank you!

<?php  

// IE6 string from user_agent  
$ie6 = "MSIE 6.0"; // detect browser
$browser = $_SERVER['HTTP_USER_AGENT']; // yank the version from the string
$browser = substr("$browser", 25, 8); // html for error
$error = "<div class="\"error\"" id="\"error\""><strong>Alert:</strong> It appears that you are using an out dated web browser Internet Explorer. While you may still visit this website we encourage you to upgrade your web browser so you can enjoy all the rich features this website offers as well as other websites. Follow this link to <a href="\"http://www.microsoft.com/windows/downloads/ie/getitnow.mspx\""><strong>Upgrade your Internet Explorer</strong></a><br><div class="\"kickRight\""><a href="\"javascript:" killit('error');\"=""> Close This Box</a></div></div>"; // if IE6 set the $alert
if($browser == $ie6){ $alert = TRUE; }
?>

    Look carefully at the double quotes. You are not escaping them correctly. A text editor with syntax highlighting can help.

      can you point in the right place to look up the correct syntax? I use dreamweaver and its not helping much.

        Okay, this:

        "<div class="\"error\""

        should be:

        "<div class=\"error\"

        You need to make the same correction several times.

        The reason is that with that extra double quote, you end up with a string:

        "<div class="

        and then something weird in the middle of nowhere:

        \"error\""

          If you look in the PHP manual for what a [man]string[/man] is, there are also examples of how to properly escape string delimiters.

            Write a Reply...