Jump to content

Small PHP Problem HELP!!


needphp

Recommended Posts

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.