I've read this post(how do i send a variable in the url in javascript), 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:
Page1
<?php
session_start();
$userid = $_SESSION['userid'];
?>
<head>
<script type="text/javascript">
function open_win()
{
window.open("http://www.mysite.com/exams/print.php?uid_print=$userid",'','width=200,height=100')
}
</script>
</head>
<?php
if ($_SESSION['auth']) {
include 'datalogin.php';
echo "<input type='button' value='Print this page' onclick='open_win()' />";
Page2(print.php)
<?php
session_start();
include 'datalogin.php';
$uid_print1 = $_GET['uid_print'];
echo $uid_print1;
But my ouput is: $userid