View Full Version : Set and use a variable to control page Colors
08-07-2008, 11:11 PM
Hi There, I would like to build a page that displays a certain image, and background color based on a variable sent in the URL string. Can someone please give me a simple explanation on how to do this?
Here is a link to my test page...
I would like the variable A1 to determine that image 1.jpg will be used, and that #7F8F91 is the background color.
Any suggestions are welcome, thanks.
08-08-2008, 01:19 AM
$id = $_GET['ID'];
$bgcolor = '#7F8F91';
$image = '1.jpg';
$bgcolor = '#FF9999';
$image = '2.jpg';
$bgcolor = '#FFFFFF';
$image = 'defaultimage.jpg';
background-color:<?php echo $bgcolor; ?>;
<img src="images/<?php echo $image; ?>" />
08-09-2008, 01:15 AM
Thanks! that worked great for me.
Do you have any idea how I could use this to update a page, WITHOUT having to reload the page? I just want a link to update the background and image on the fly.
08-09-2008, 01:39 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.