redarrow Posted August 5, 2006 Share Posted August 5, 2006 I am creating the admin part for a site can you kindly show me what i have done wrong the colours are outside the box but why?[code]<?php$red="<table width='3%' height='6%' bgcolor='red'><td></td></table>";$green="<table width='3%' height='6%' bgcolor='green'><td></td></table>";$blue="<table width='3%' height='6%' bgcolor='blue'><td></td></table>";?><form method="POST" action=""><select name="back_ground"><option value="red"><? echo $red ?></option><option value="green"><? echo $green ?></option><option value="blue"><? echo $blue ?></option><input type="submit" name="submit" value="choose colour"></select></form>[/code] Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/ Share on other sites More sharing options...
extrovertive Posted August 5, 2006 Share Posted August 5, 2006 What are you trying to do? Have a user select a color and then a table bgcolor will change?Try this:[code=php:0]<?php$defaultcolor = "white";$back_ground = $_POST['back_ground'];if(!isset($back_ground)) $back_ground = $defaultcolor;echo "<table width='3%' height='6%' bgcolor='$back_ground'>";echo "<td>";?>Anything can go here<?phpecho "</td>";echo "</table>";?><form method="post" action="crap.php"><select name="back_ground"><option value="red">Red</option><option value="green">Green</option><option value="blue">Blue</option><input type="submit" name="submit" value="choose colour"></select></form>[/code]Modify it to however you like. Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69577 Share on other sites More sharing options...
redarrow Posted August 5, 2006 Author Share Posted August 5, 2006 This is for the user to choose a color from the pull down box then the database gets that color inserted to database ok.when that color is inserted to the database then it will change the color to the users selection of what color they want for what ever.hope you can help cheers. Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69580 Share on other sites More sharing options...
Drumminxx Posted August 5, 2006 Share Posted August 5, 2006 if your trying to display the color in the drop down you need to set the style propertytake a look at hishttp://pietschsoft.com/blog/Post.aspx?PostID=204 Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69581 Share on other sites More sharing options...
extrovertive Posted August 5, 2006 Share Posted August 5, 2006 Get a color from a database? Color gets inserted into the database? What are the fields in your table?Btw, have you try running the code I posted?Seems like me and drumminxxx both misunderstood your questions. Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69583 Share on other sites More sharing options...
redarrow Posted August 5, 2006 Author Share Posted August 5, 2006 Drumminxx was correct thank you so much. Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69584 Share on other sites More sharing options...
extrovertive Posted August 5, 2006 Share Posted August 5, 2006 ah i see. should've said "making a select form with colors" Link to comment https://forums.phpfreaks.com/topic/16601-select-box-with-colors-please-help/#findComment-69609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.