cmgmyr Posted June 30, 2006 Share Posted June 30, 2006 I just made a style switcher for my site and now the page doesn't validateThe site is www.chrisgmyr.com go to the validation results.here is style-switcher.php[code=php:0]<?php session_start(); $all_css = array(); $all_css['default']['file'] = "css/style.css"; // default $all_css['red']['file'] = "css/red.css"; $all_css['blue']['file'] = "css/blue.css"; $all_css['green']['file'] = "css/green.css"; $all_css['default']['label'] = "Default"; // default $all_css['red']['label'] = "Red"; $all_css['blue']['label'] = "Blue"; $all_css['green']['label'] = "Green"; $default_value = "default"; // set the default value here if (isset($_GET['change_css']) && $_GET['change_css'] != "") { $_SESSION['css'] = $_GET['change_css']; } else { $_SESSION['css'] = (!isset($_SESSION['css'])) ? $default_value : $_SESSION['css']; } switch ($_SESSION['css']) { case "red": $css_file = "css/red.css"; break; case "blue": $css_file = "css/blue.css"; break; case "green": $css_file = "css/green.css"; break; default: $css_file = "css/style.css"; } function style_switcher() { global $all_css,$PHP_SELF; $self = $PHP_SELF; $stripslash = explode("/", $self); $self = $stripslash[1]; $style_links = ""; foreach ($all_css as $key => $val) { if ($_SESSION['css'] != $key) { $style_links .= "<a href=\"$self?change_css=$key\">"; $style_links .= "".$val['label']."</a>"; } else { $style_links .= "<span class=\"current\">".$val['label']."</span>"; } } return $style_links; } ?>[/code]any ideas on what I can do to fix it?Thanks,-Chris Link to comment https://forums.phpfreaks.com/topic/13306-session-and-xhtml-validation-error/ Share on other sites More sharing options...
AndyB Posted June 30, 2006 Share Posted June 30, 2006 Easy solution - adjust the arg separator - http://www.w3.org/QA/2005/04/php-session Link to comment https://forums.phpfreaks.com/topic/13306-session-and-xhtml-validation-error/#findComment-51274 Share on other sites More sharing options...
cmgmyr Posted June 30, 2006 Author Share Posted June 30, 2006 cool, thanks i'll check it out Link to comment https://forums.phpfreaks.com/topic/13306-session-and-xhtml-validation-error/#findComment-51282 Share on other sites More sharing options...
cmgmyr Posted July 1, 2006 Author Share Posted July 1, 2006 I just decided to change it to cookie based instead...it works great! Link to comment https://forums.phpfreaks.com/topic/13306-session-and-xhtml-validation-error/#findComment-51557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.