I am trying to add a link in the header of my page that reads "Print" and allows the user to go to any page on the site and just click "Print" at the top of the page and it calls up a new style sheet that strips off the header, menu, and everything else and creates a printer friendly version of that page. So I added <a href = '<?php echo $_SERVER['PHP_SELF']; ?>?print_me=yes'>Print</a>
</div> to the header and an if statement that says if print_me=yes use print.css, else use main.css.
Everything works pretty well, but here is my problem. When a user navigates to find something on the site the URL might look something like this http://www.jpeake.com/agteacher2/institution.php?sorter=institution&id=Williston+High+School
. When the user clicks "Print" on the header the print.css style sheet is called up, but the new page that loads is missing the ?sorter=institution&id=Wil
h+School part of the URL... so the url now reads http://www.jpeake.com/agteacher2/institution.php?print_me=yes
and that doesn't do the user any good because now they can't print what they were trying to.
Any idea how to retain the string in the URL that comes after ? and append &print_me=yes to it? I understand how to use $_SERVER['PHP_SELF'] ,but I don't know how to make it get the entire url and string together.
<a href = '<?php echo $_SERVER['PHP_SELF']; ?>?print_me=yes'>Print</a></div>