Blog Home | Fife Visits Blog | Fife Rant Blog | Random Computing Stuff Index

Investigating PHP

I am currently working my way through MySQL for Dynamic Websites by Larry Ullman (edition 4).
I currently (December 2012) run php 5.3.10-10 and a mysql 5.1.28 database on apache 2.2.22 server on Ubuntu 12.04 in VirtualBox.

Chapter 12: Review and Pursue

Choose Colour: Jan 2013

The php code in the pdf below is an investigation of the 5th Pursue element of Chapter 12 PHP and MYSQL for Dynamic Web Sites (ed4) by Larry Ullman.
This bit of script just changes the look of a web page by clicking a radio button. Clearly, you can get a bit more complicated depending on how you write the css files. After looking around on the 'net to what others had done because there is almost always someone who has done this and published their results, I decided to have a crack at this myself. The code was not quite like anyone elses since I started from first principles starting with 3 scripts that created then queried cookie results. They got boiled down to this.
This script is basic as I only wanted to get the idea to work. It may have holes in it. Caveat emptor.
The css is so short I didn't bother sticking it in a pdf.


blue.css
p{ color: blue; }

red.css
p{ color: red; }

green.css
p{ color: #00782B; }

If the pdf doesn't open, go to Choose a font colour.pdf