dreampho Posted February 10, 2011 Share Posted February 10, 2011 Hi. I am looking for a way to have a button that toggles the background colour of my website. So for instance, I will have one button called 'switch to light', when its clicked it switches the colour of the background to a light colour, and another button replaces this that says 'switch to dark', and so on. I have turned to PHP because it appears to be the only way I would be able to have the change saved throughout the site, when pages are refreshed. However, I am a complete newbie, so have no idea what to do! Anyone that can help is a life saver! Thanks Link to comment https://forums.phpfreaks.com/topic/227274-toggle-background-colour/ Share on other sites More sharing options...
acefirefighter Posted February 11, 2011 Share Posted February 11, 2011 Your question is very vague. If you are looking for someone to type this for you it has already been done a thousand times a thousand different ways using many different languages. (P.S. Google is your friend).... No matter how you do this whether you use php or javascript you are going to be saving the color information to a cookie or to the session you will then retrieve this information to display across the site. Both languages are perfectly capable of doing what you need. You could actually use the database too so that you could make this change even more persistent, but after a few searches you should be able to find some information. I am sure there are many people here who would be more than happy to help you with "YOUR" code so if you have any questions about your code feel free to post them and you will get help much faster. Link to comment https://forums.phpfreaks.com/topic/227274-toggle-background-colour/#findComment-1172858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.