Okay, this is what I have: <?php $title = "Template Page"; echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd" />'; echo '<head><title>' ,$title, '</title>'; switch ($_POST['style']) { case "default": echo '<link rel="stylesheet" href="style1.css" type="text/css"/>'; break; case "black": echo '<link rel="stylesheet" href="style2.css" type="text/css"/>'; break; case "purple": echo '<link rel="stylesheet" href="style3.css" type="text/css"/>'; break; case "white": echo '<link rel="stylesheet" href="style4.css" type="text/css">'; break; case 0: echo '<link rel="stylesheet" href="style1.css" type="text/css"/>'; break; } echo '</head><body>'; echo '<form action="index.php" method="post"> <select name="Template"> <option type="radio" value="default" name="style">Default</option> <option type="radio" value="black" name="style">Black</option> <option type="radio" value="purple" name="style">Purple</option> <option type="radio" value="white" name="style">White</option></select> <input type="submit" name="Change Style" /></form>'; echo '<div class="nav"><a href="index.php">Home</a> | <a href="register.php">Register</a> | <a href="links.php">Links</a> | <a href="faq.php">FAQ</a></div>'; echo '</body></html>'; ?> PHP: And here's 1 of 4 style sheets: <style type="text/css"> div.nav { position:absolute; top:75px; left:10%; right:10%; width:80%; background-color:#0099FF; text-align:right; } body { background-color:#333333; } </style> PHP: When I select and reload the page it just shows the content with a white background, not the bg color specified in the CSS.
I think it's the stylesheet. Is the php showing <link rel="stylesheet" href="stylex.css" type="text/css"/> correctly - i.e. changing the stylesheet ? EDIT - Actually it's the select name : change it to : <select name="style"> Code (markup):
Thanks. I just tried changing the select name to "style" yet it still doesn't work. I get the same effect. Any other ideas or suggestions? It'd be greatly appreciated.
I think you're right though about the style sheet. For some reason it's not sending it to the page. I know this because I printed unique text on each style sheet and ran the script - but the text didn't show no matter what I selected. Any thoughts or ideas?
I hate to tripple post but I can here's a little update. Basically I can get the default case ( case 0 ) to show and use that style sheet. However, I can't select one and have it use it. Apparently when I submit it doesn't send the data (or doesn't accurately read the data) to select the proper style sheet.
What was the problem - the default value ? It was working here yesterday but I removed the 0 and default.
Two problems. 1) the select name, as you said. 2) I had foolishly misnamed a file... rather than .css I had .php.