needphp Posted April 28, 2008 Share Posted April 28, 2008 I need to make the following script change style sheets when some body clicks the printer friendly link here is the script below but for some reason it wont work. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <HTML> <HEAD> <TITLE> New Document </TITLE> <?php if($mode == 'print') $stylesheet = 'print.css'; else $stylesheet = 'style.css'; echo '<link rel="stylesheet" href="'.$stylesheet.'" type="text/css" />'; ?> </HEAD> <BODY> <a href="<?php echo $_SERVER['PHP_SELF'].'&mode=print'; ?>" title="" id="print"><img src="printer.gif" alt="" width="20" height="23" />Print</a> <p>some random text</p> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/103218-small-php-problem-help/ Share on other sites More sharing options...
rofl90 Posted April 28, 2008 Share Posted April 28, 2008 Try: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <HTML> <HEAD> <TITLE> New Document </TITLE> <?php if($_GET['mode'] == 'print') $stylesheet = 'print.css'; else $stylesheet = 'style.css'; echo '<link rel="stylesheet" href="{$stylesheet}" type="text/css" />'; ?> </HEAD> <BODY> <a href="?mode=print" title="" id="print"><img src="printer.gif" alt="" width="20" height="23" />Print</a> <p>some random text</p> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/103218-small-php-problem-help/#findComment-528701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.