I'm working on a project, where I need to change the CSS on the page with radio buttons. When I select the style what I want and click the submit button It needs to be able to refresh the same page but with the selected CSS. I have the four buttons and for them I have four different CSSs. I am trying to use a php file and switch statement.
I use external css:
- Code: Select all
<link rel="stylesheet" type="text/css" href="<? stl.php?>" />
Here is the code for the form:
- Code: Select all
<form method="post" action="stl.php">
Dark: <input type="radio" name="style" value="1"/> |
Light: <input type="radio" name="style" value="2" /> |
Business: <input type="radio" name="style" value="3" /> |
Fancy: <input type="radio" name="style" value="4" /> <hr />
<center>
<input type="submit" value="Change Style" />
</center>
</form>
For the stl.php file I don't have a lot.
- Code: Select all
<?
$stl = $_REQUEST['style'];
switch($stl)
{
case 1: 'need the code" "css/style1.css";
break;
case 2: 'need the code' "css/style2.css";
break;
case 3: need the code' "css/style3.css";
break;
case 4: "css/style4.css";
break;
}
?>
I was thinking of overwriting a file with the different CSSs but after that How I can refresh the page and I get the CSS what I want.
If you have any ideas or some code it will be very helpful.
Thank's in advance

