title: Echo PHP inside Javascript?
body: <p>Why is this not working?</p>
  
  <pre><code>&lt;?php 
  
  mysqli_select_db($connect,"dev");
  $response = "Select response from revbut where session='$u'";
  $rquery  =  mysqli_query($connect,$response);
  
  $responseanswer = mysqli_fetch_array($rquery);
  $re  = $responseanswer['response'];
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
  &lt;?php echo $re; ?&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p><code>$re</code> inside JavaScript is not getting echoed. But if I place it inside the above PHP function, it is getting echoed.</p>
  
  <p>EDIT - BUT THEN WHY IS THIS NOT WORKING? </p>
  
  <pre><code>if(&lt;?php echo $re; ?&gt;){
      document.getElementById('hide').style.display = "none";
  }
  </code></pre>
  
  <p>if I PLACE the hide function outside the if - it is working.</p>