pwes24 Posted March 19, 2008 Share Posted March 19, 2008 Hello everyone. I'd like to create a user friendly admin file where one can change elements like coloron a different web page. For example, to change the background of a web page, the client just logs on to the admin panel and makes the change. How do I write code to go to the web page and update this information permanently? Your help will be apperciated. Link to comment https://forums.phpfreaks.com/topic/96843-changing-elements-of-a-web-page/ Share on other sites More sharing options...
Stooney Posted March 19, 2008 Share Posted March 19, 2008 Databases. You would store the background color in somewhere in a MySQL table, then just call it. ex. <?php $result=mysql_fetch_array(mysql_query("SELECT bgcolor FROM site_config")); ?> <body bgcolor="<?php echo $result['bgcolor']; ?>"> That's just a quick example. There's better ways to go about it in the end, but that should give you an idea. As for the admin part you would just have another script that would update that table in the database. ex. if(isset($_POST['color']) && $_POST['color']!=''){ $update=mysql_query("UPDATE site_config SET bgcolor='".mysql_real_escape_string($_POST['color'])."'"); } <form action="update.php" method="post"> Color: <input type="text" name="color"> <input type="submit" value="Update"> </form> Link to comment https://forums.phpfreaks.com/topic/96843-changing-elements-of-a-web-page/#findComment-495615 Share on other sites More sharing options...
pwes24 Posted March 19, 2008 Author Share Posted March 19, 2008 This is good. But if I'd like to change the style of content e.g fonts, size across the website, this may way down the servers. What do you think? Link to comment https://forums.phpfreaks.com/topic/96843-changing-elements-of-a-web-page/#findComment-495623 Share on other sites More sharing options...
l0ve2hat3 Posted March 19, 2008 Share Posted March 19, 2008 maybe you can use file functions to write a CSS file???? Link to comment https://forums.phpfreaks.com/topic/96843-changing-elements-of-a-web-page/#findComment-495626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.