title: send php variable value via javascript in url
body: <p>I've read <a href="https://stackoverflow.com/questions/5751774/how-do-i-send-a-variable-in-the-url-in-javascript">this post</a>(<a href="https://stackoverflow.com/questions/5751774/how-do-i-send-a-variable-in-the-url-in-javascript">how do i send a variable in the url in javascript</a>), but can't get it to work.  I must add that I don't know javascript at all.  I'm trying to open an new "printer friendly" page in php, but in order for that I need to send the userid with the url, my code looks like this:</p>
  
  <p><strong>Page1</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  $userid = $_SESSION['userid'];
  ?&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function open_win()
  {
  window.open("http://www.mysite.com/exams/print.php?uid_print=$userid",'','width=200,height=100')
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;?php
  if ($_SESSION['auth']) {  
  include 'datalogin.php';
  
  echo "&lt;input type='button' value='Print this page' onclick='open_win()' /&gt;";
  </code></pre>
  
  <p><strong>Page2(print.php)</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  include 'datalogin.php';
  $uid_print1 = $_GET['uid_print'];
  
  echo $uid_print1;
  </code></pre>
  
  <p>But my ouput is:  $userid</p>