Jump to content

select box with colors please help


redarrow

Recommended Posts

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
Share on other sites

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
<?php
echo "</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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.