How to change background color of Body of a web page or any div or any section’s background color dynamically through PHP ?

Below is the example of changing background color of whole body dynamically of a webpage. You can further apply the same method for each and every div or for each and every section of your web page.

<!DOCTYPE html>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 echo "Please write color name or color code";
 <style> body{background-color:<?php echo $_REQUEST['bg'];?>;} </style>
 <?php }
 <form action="index.php" method="post">
 <input type="text" name="bg"/>
 <input type="submit" name="submit" value="Change"/>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s