1. Home
  2. Computing & Technology
  3. PHP / MySQL

PHP CSS Switcher

By Angela Bradley, About.com

3 of 3

Making the Choice

Passing along the style choice to our changestyle.php script is easy, and can be done from any page. In the most simple form all you need to do is append their choice to a link. Here is an example:
<a href="changestyle.php?choice=classic"> Classic View</a> | <a href="changestyle.php?choice=hoiday"> Holiday View</a> | <a href="changestyle.php?choice=normal"> Normal View</a>
The code above simply links to three styles: Classic, Holiday, or Normal (our default style).

Another way to do it is with a drop down menu:

<form action="changestyle.php" method="post">
<select name="choice">
<option value="classic" selected>Classic View</option>
<option value="holiday">Holiday View</option>
<option value="normal">Normal View</option>
</select>
<input type="submit" value="Go">
</form>
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Step By Steps
  5. CSS Switcher PHP - PHP Style Switcher - PHP Change CSS

©2009 About.com, a part of The New York Times Company.

All rights reserved.