Forum Moderators: coopster

Message Too Old, No Replies

Help with sessions

         

adammc

5:10 am on Jun 22, 2006 (gmt 0)

10+ Year Member



Hi folks,
I am designing a website for a disability organisation. I want to provide a link for them to view the site in larger fonts.

I am linking like so:
index.php?stylesheet=big

Here is my current code:

[PHP]<?php

session_start();
$stylesheet = $_GET['stylesheet'];
session_register("stylesheet");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>

<?php

if (!isset($_SESSION['stylesheet'])) {
echo "<link href='$_SESSION[stylesheet]'.css' rel='stylesheet' type='text/css'>";

} else{

echo "<link href='stylesheet.css' rel='stylesheet' type='text/css'>";
}

?>[/PHP]

I have echoed the session stylesheet variable and its being set, however it is not changing the stylesheet?

Any ideas?

omoutop

5:56 am on Jun 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



index.php?stylesheet=big
big.css exists in same folder as the page you are loading?

adammc

6:26 am on Jun 22, 2006 (gmt 0)

10+ Year Member



I got it sorted thanks anyway :)

dreamcatcher

7:02 am on Jun 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



adammc,

Why not store the option in a cookie instead? That way when they return to the page they don`t have to re-select the larger font.

Just a thought.

dc