Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

boolean check boxes mysql/php



11:24 pm on Apr 15, 2013 (gmt 0)

Basically i need to make the page display the data from one of my tables and then show the boolean as the end of each row as a check box, can someone please show me how this is done?


2:11 pm on Apr 22, 2013 (gmt 0)

5+ Year Member

if in your table you have a column with true or false written in it you could do something like this :
if ($yourValue == "true") {
<input type="checkbox" name="checkbox" id="checkbox1" value="$yourValue" checked />
else {
<input type="checkbox" name="checkbox" id="checkbox1" value="$yourValue" />


4:57 pm on Apr 22, 2013 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I'd use the proper attribute of checked="checked" if you're going to go for the (xml) self closing tags.

Since it's going to be executed in a loop, I'd lose the id or make sure they are unique if you need them.

In your table you can use a true boolean instead of a string. just test it with if ...

Featured Threads

Hot Threads This Week

Hot Threads This Month