PHP Undefined variable and Javascript
<p>I have tried to figure this out myself I am new to PHP and I know its easy but I am missing something. I am trying to create something that if someone click a Button have it pass a value called id from the button hyper link for example:</p>

<pre><code>     &lt;a href="abc123.html?id=d"&gt;Click Here...&lt;/a&gt;
</code></pre>

<p>Then have the page abc123.html load and at the top of the page run this script below which is to see if id = f then if it does run the javascript code if not don't run it.</p>

<pre><code>    &lt;?php
    $vid = $_GET["id"];
    if ($vid != "f") {

       echo "&lt;script type=""text/javascript""&gt;"
            echo "if (screen.width&lt;800)"
            echo "{"
            echo "window.location=""../mobile/default.html"""
            echo "}"
       echo "&lt;/script&gt;"
    }
    ?&gt;
</code></pre>

<p>However I am getting an PHP Undefined variable error from the Get ID. I have tried to use isset and that doesn't seem to work. But I know the error is caused if the value of id is blank because the id value might not always be available only if the user clicks on the abc123.html link. Can someone please tell me what I am doing wrong?</p>

<p>I have researched answers here: </p>

<p><a href="http://stackoverflow.com/questions/8157072/undefined-variable-php">Undefined variable php</a></p>

<p><a href="http://stackoverflow.com/questions/910457/undefined-variable-error-in-php">Undefined variable error in PHP</a></p>

<p>and here...</p>

<p><a href="http://matthom.com/archive/2005/02/19/php-passing-variables-across-pages" rel="nofollow">http://matthom.com/archive/2005/02/19/php-passing-variables-across-pages</a></p>

<p>and here...</p>

<p><a href="http://www.w3schools.com/php/php_if_else.asp" rel="nofollow">http://www.w3schools.com/php/php_if_else.asp</a></p>
