What does this PHP notice mean?
<pre><code>&lt;?php
    $username="xxx";
    $password="xxx";
    $database="mobile_app";

    mysql_connect('localhost',$username,$password);

    @mysql_select_db($database) or die( "Unable to select database");

    foreach (array('courseid','roomChosen') as $varname) {
        $$varname = (isset($_POST[$varname])) ? $_POST[$varname] : '';
    }

    if (isset($_POST['prequestion'])) {
        $roomquery = "
                     SELECT Room
                     FROM Room
                     WHERE
                     (Room = '".mysql_real_escape_string($roomChosen)."')
                     ";

        $roomnum = mysql_num_rows($roomresult = mysql_query($roomquery));
        mysql_close();

        if($roomnum ==0){
            $msg = "This Room is Invalid '$roomChosen'";
        } 
        else {
            $msg = "This Room is Valid '$roomChosen'";
        }
    }
    $d = array("msg" =&gt; $msg);
    echo json_encode($d);
?&gt;
</code></pre>

<p>In this line of code near the bottom:</p>

<pre><code>$d = array("msg" =&gt; $msg);
</code></pre>

<p>I am getting this notice:</p>

<blockquote>
  <p>Notice: Undefined variable: msg in /u08877587/Mobile_app/room2.php on line 46
  {"msg":null}</p>
</blockquote>

<p>How do I fix this notice?</p>
