need help
Posted: Thu Dec 17, 2009 4:09 pm
Hi! I have just a little problem. I want to make a website where user can chose hes own style.
everything is working exept in the very first loading of the page there isnt any style, but why?
the error is Undefined index: css in C:\wamp\www\index.php on line 6. i can understand that theres no value but why?
also when i click the christmas style link i have to press reload to get it
stylechooser.php file looks like this:
<?php
$switch = (isset($_GET['mode'])) ? $_GET['mode'] : "index";
switch($switch) {
#option 1
case "christmas":
$css = "/christmas.css";
#setting session.
$_SESSION['css'] = $css;
break;
#option 2
case "fancy":
$css = "/fancy.css";
$_SESSION['css'] = $css;
break;
#reset to the default
default:
$css = "/default.css";
$_SESSION['css'] = $css;
break;
}
?>
And the index.php-s beginning looks like this :
<html>
<head>
<?php
session_start();
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$_SESSION['css']}\" media=\"screen\">";
?>
</head>
<title></title>
<body>
<?php include("style_chooser.php");?>
<?php include("visits.php");?>
<a href='?mode=christmas'>here</a>
everything is working exept in the very first loading of the page there isnt any style, but why?
the error is Undefined index: css in C:\wamp\www\index.php on line 6. i can understand that theres no value but why?
also when i click the christmas style link i have to press reload to get it
stylechooser.php file looks like this:
<?php
$switch = (isset($_GET['mode'])) ? $_GET['mode'] : "index";
switch($switch) {
#option 1
case "christmas":
$css = "/christmas.css";
#setting session.
$_SESSION['css'] = $css;
break;
#option 2
case "fancy":
$css = "/fancy.css";
$_SESSION['css'] = $css;
break;
#reset to the default
default:
$css = "/default.css";
$_SESSION['css'] = $css;
break;
}
?>
And the index.php-s beginning looks like this :
<html>
<head>
<?php
session_start();
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$_SESSION['css']}\" media=\"screen\">";
?>
</head>
<title></title>
<body>
<?php include("style_chooser.php");?>
<?php include("visits.php");?>
<a href='?mode=christmas'>here</a>