dynamic radio buttons.. checked or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys.. hopefully someone can help with this.
 
Code:
 
                $query = "select t.id, t.thread_index, t.pattern_index,
t.avail, p.id, p.type, p.colour, p.colourID, p.manufacturer FROM
kcs_patternthreads t LEFT JOIN kcs_threads p ON t.thread_index = p.id
WHERE t.pattern_index = $id";
 
                $thread_manufacturer = '';
 
                $result = db_query($query);
                while($thread = db_fetch($result)) {
 
                                if($thread_manufacturer !=
$thread['manufacturer']) {
 
                                                echo "<tr
valign=\"top\">\n";
                                                echo "      <td
colspan=\"2\"><font class=\"adminHeader\">Threads:</font> <font
class=\"adminSelectBox\">{$thread['manufacturer']}</font></td>\n";
                                                echo "</tr>\n";
                                                $thread_manufacturer =
$thread['manufacturer'];
 
                                }
 
                                $thread_colourID =
str_pad($thread['colourID'], 8, " ", STR_PAD_RIGHT);
                                $thread_type = str_pad($thread['type'],
20, " ", STR_PAD_RIGHT);
                                $thread_colour =
str_pad($thread['colour'], 20, " ", STR_PAD_RIGHT);
                                
                                $thread_colourID = str_replace("
","&nbsp;", $thread_colourID);
                                $thread_type = str_replace(" ","&nbsp;",
$thread_type);
                                $thread_colour = str_replace("
","&nbsp;", $thread_colour);
 
                                echo "<tr valign=\"middle\">\n";
 
                                                echo "      <td
colspan=\"2\" style=\"font-family:monospace;color: #696565;font-size:
9pt;\">{$thread_colourID}{$thread_type}{$thread_colour}Available to
Order: &nbsp;Yes<input type=\"radio\" name=\"avail\" value=\"1\"";
 
                                if ($thread[avail] == 1) echo "
checked"; //is this record available?
 
                                                echo
">&nbsp;&nbsp;&nbsp;No<input type=\"radio\" name=\"avail\" value=\"0\"";
 
                                if ($thread[avail] == 0) echo "
checked"; //is this record not available?
 
                                                echo "></td>\n";
 
                                echo"</tr>\n";
                }
 
END CODE
 
Everything on this script works except the radio button "checked" part. 
 
What's supposed to happen is if $thread[avail] == 1 then display the YES
radio as "checked" for that record and if $thread[avail] == 0 then
display the NO radio as checked for that record.
 
I did an echo on $thread[avail] and I get the correct values:
 
0
1
0
 
 
Does anyone have a clue as to my problem here?
 
Thanks in advance!
 
Aaron
 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux