<? $message="dd"; ?> <script> function change(col) { document.getElementById('col').style.backgroundColor=col; } </script> <form action="" method="post"> <input type='search' name='keywords' value='' style="width:100%;"> <a href='#col'> <input type=submit value='Submit' name='doSearch' style="visibility: hidden;" onclick="enter(this.href)" /> </a> </form> <div style="width:50px; height:50px;" id="col" onclick="location.href='index2.php';" > <br/> <?php echo $message ?> </div> <? if(isset($_POST['keywords'])){ ?> <script> change('<?=$_POST['keywords']?>'); </script> <? } ?>
check it, it works by inserting color on the entered keywords
source share