using session with style tags one can change the color of table or form input
By : khabir
<? @session_start();
$_SESSION['color']=$_POST['col'];
$_SESSION['sel']=$_POST['inp'];
$_SESSION['inp']=$_POST['inp'];
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;
}
input {
background-color:<? if($_SESSION['inp']!='') echo $_SESSION['inp']; else echo '#663399'; ?>
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
}
select {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background-color:<? if($_SESSION['sel']!='') echo $_SESSION['sel']; else echo '#669999'; ?>
}
-->
</style>
</head>
<!--
Save this page as color.php
Author: Md. khabir uddin khan
mdkhabir@yahoo.com
-->
<body>
<form name="form1" method="post" >
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="31%"> </td>
<td width="69%"> </td>
</tr>
<tr>
<td height="26">
<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><div align="right">Change input Color:</div></td>
<td><select name="inp" id="inp">
<option value="#339900">#339900</option>
<option value="#335566">#335566</option>
<option value="#66f9ff">#66f9ff</option>
<option value="#efdf66">#efdf66</option>
<option value="#fd66ff">#fd66ff</option>
<option value="#ff66cc">#ff66cc</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.
More Miscellaneous Code Articles More By Codewalkers
Please enable JavaScript to view the comments powered by Disqus. blog comments powered by