Jump to content

changing color of radio buttons


chiefrokka

Recommended Posts

if you don't mind, could you post an example of how to do that exactly?  i'm not familiar with classes and css.  sorry if this isn't really a php question I guess, but you guys are the best!

 

I tried this but it didn't really work:

 

<style type="text/css">
<!--
body {
background-image: url();
background-repeat: repeat;
}
.radiobutton {
background : #FFCC00;
color : #FF0000
}
-->
</style>

<input class="radiobutton" type="radio" name="Pick" value="Team2" id="Pick">

 

Well here's an example

 

<style>
.input.r1{
background-color: #CCCCFF;
border: 1px dotted #9900FF;
  font-size: 15px;
  color: red;
}
.input.r2{
background-color: red;
border: 1px solid #9900FF;
  font-size: 15px;
  color: green;
}
</style>

 

then in php

after you query the table

you can use a switch or an if then to select

switch($fieldname){
case "1":
$class = "r1";
break;
case "2":
$class = "r2";
break;
default:
$class = "";
}
echo "<input type=radio class=$class name=somename>\n";

 

Ray

thanks ray, but unless i did something wrong your code didn't work with my Firefox browser.

I copied/pasted your styles and then pasted your input

 

<?php
if ($flag == 1)
{ echo "<input type=radio class='r1' name='Pick' id='Pick' value='Team1' disabled>\n"; }
else
{ echo "<input type=radio class='r2' name='Pick' id='Pick' value='Team1' >\n"; }	
?>

 

hmm... stupid radio buttons.  lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.