#native_company# #native_desc#
#native_cta#

Change Table and page back color

By Md. Khabir Uddin Khan
on November 9, 2004

Version: 1.01

Type: Full Script

Category: Graphics

License: GNU General Public License

Description: This is the technique to use session and change the color of the page as you like.One can use the database to store color value and set when the page is loaded.save script as php file.

<? @session_start();
$_SESSION['color']=$_POST['col'];
echo 'Table background color: ',$_POST['col'];

?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
table {
	background-color: <? if($_SESSION['color']!='') echo $_SESSION['color']; else echo '#999900'; ?>; 
}
td {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bolder;
	color: #CCFF66;
}
-->
</style>
</head>
<!--
Save this page as color.php
Author: Md. khabir uddin khan
[email protected]
-->
<body>
<form name="form1"  method="post" >
  <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="46%">&nbsp;</td>
      <td width="54%">&nbsp;</td>
    </tr>
    <tr>
      <td><div align="right">Change Color:</div></td>
      <td><select name="col" id="col">
          <option value="#336600">#336600</option>
          <option value="#999966">#999966</option>
          <option value="#669966">#669966</option>
          <option value="#ef5966">#ef5966</option>
          <option value="#3366ff">#3366ff</option>
          <option value="#ff6600">#ff6600</option>
        </select></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Submit"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>