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)

New User

joined:Apr 12, 2013
posts: 4
votes: 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)

Junior Member

5+ Year Member

joined:Nov 16, 2008
posts: 136
votes: 0

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)

Senior Member

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

joined:Aug 7, 2003
votes: 0

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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members