homepage Welcome to WebmasterWorld Guest from
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

 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)

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)

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