Jump to content


Photo

select box with colors please help


  • Please log in to reply
6 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 12:13 AM

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?




<?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>


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 05 August 2006 - 02:00 AM

What are you trying to do? Have a user select a color and then a table bgcolor will change?

Try this:

<?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>

Modify it to however you like.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 02:14 AM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 05 August 2006 - 02:16 AM

if your trying to display the color in the drop down you need to set the style property

take a look at his

http://pietschsoft.c...aspx?PostID=204
:: gucci.com ::
:: blockbuster.com ::

--------------------

#5 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 05 August 2006 - 02:21 AM

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.

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 02:24 AM

Drumminxx  was correct thank you so much.


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 05 August 2006 - 04:18 AM

ah i see. should've said "making a select form with colors"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users