title: php echo javascript alert() not working
body: <p>I would like to display a popup message when user is logged out, so I use</p>
  
  <pre><code>echo "&lt;script&gt;alert(\"You are logged out\");&lt;/script&gt;";
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>Below is my coding. Is there any logic problem in my coding?</p>
  
  <pre><code>&lt;?php
  session_start();
  if(isset($_SESSION['Username']) == "admin")
  {
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;style type="text/css"&gt;
  @import "../CSS/Style.css";
  @import "../CSS/Admin.css";
  &lt;/style&gt;
  &lt;title&gt;Admin Home Page&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div class="body"&gt;&lt;/div&gt;
  &lt;?php
      if(isset($_GET['id']) == "logout")
      {
          session_destroy();
          echo "&lt;script&gt;alert(\"You are logged out\");&lt;/script&gt;";
          header("Location: ..\Main.php");
      }
      else
      {
  ?&gt;
  &lt;div class="menu"&gt;
      &lt;a href="ManageStaff.php"&gt;Manage Staff&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class="menu2"&gt;
      &lt;a href="ManageAccount.php"&gt;Manage Account&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class="logout"&gt;
      &lt;a href="AdminHomePage.php?id=logout"&gt;Logout&lt;/a&gt;
  &lt;/div&gt;
  &lt;?php
      }
  }
  else
  {
  ?&gt;
  &lt;center&gt;
  &lt;p style="font-size:50px; font-weight:bold"&gt;Access Denied&lt;/p&gt;
  &lt;p style="font-size:18px"&gt;Your request for this page has been denied because of access control&lt;/p&gt;
  &lt;/center&gt;
  &lt;?php
  }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The session will be destroyed and will also redirect to Main.php, just the <code>alert()</code> will not come out.</p>