title: How would I call a java script function using php if statement with $_SESSION
body: <p>Hi I am creating a website with a login section this is working I am using HTML and PHP. What I am trying to do is one of my pages has a html button I want this to be disabled for certain users. at the moment this is what I have got.</p>
  
  <p>this is the part that I use for the login details.</p>
  
  <pre><code>    &lt;?php
      session_start();
      $_SESSION["username"];
      $_SESSION["password"];
      $_SESSION["access"];
      ?&gt;
  </code></pre>
  
  <p>I have got if statments that I am currently using which are </p>
  
  <pre><code>    if($_SESSION["access"] == "Administrator"){
      echo $Admin;
      }
  </code></pre>
  
  <p>what I am trying to do is call a javascript function within a PHP if statement what i have got so far is </p>
  
  <pre><code>&lt;?php
      if($_SESSION["access"] == "Consumer")
      {
          echo '&lt;script type="text/javascript"&gt;
              Disable();
              &lt;/script&gt;';
      }
  
      if($_SESSION["access"] == "Administrator")
      {
          echo '&lt;script type="text/javascript"&gt;
              Enable();
              &lt;/script&gt;';
      }
      ?&gt;
  </code></pre>
  
  <p>the javascript functions that i am trying to call are </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     function Enable() { 
     SubmitButton.disabled = false;
     } 
  
    function Disable() { 
     SubmitButton.disabled = true;
     } 
     &lt;/script&gt;
  </code></pre>
  
  <p>I have also tryed </p>
  
  <pre><code>if($_SESSION["access"] == "Consumer")
      {
          echo "&lt;script&gt; Disable(); &lt;/script&gt;";
      }
  </code></pre>
  
  <p>Im just wondering if I have typed something in wrong or if I have forgotten to put something in.</p>
  
  <p>any help would be much appreciated.</p>