homepage Welcome to WebmasterWorld Guest from 54.166.122.65
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
boolean check boxes mysql/php
t1d2c3



 
Msg#: 4565059 posted 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?

 

skoff

5+ Year Member



 
Msg#: 4565059 posted 2:11 pm on Apr 22, 2013 (gmt 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" />
}

swa66

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



 
Msg#: 4565059 posted 4:57 pm on Apr 22, 2013 (gmt 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 ...

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved