What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » MySQL + Checkboxes

MySQL + Checkboxes
Author: Message:
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. MySQL + Checkboxes
After a few google searches, i decided this would be the best place to ask. I have 7 fields in my MySQL database table, one for each day of the week.

I have a form with a checkbox for each field, if checked it adds a "1" to the field.

When it comes to an "update" page, im not sure how to make the checkboxes ticked on the page if there is a "1" in the field in the MySQL Database. The main reason i am asking for this is because a system im working on includes a "Approval" page where an admin will have to see the days that were checked, does anyone know a simpler way or can provide me a solution to this? :D

I know its probably really easy, but thanks :)
...there used to be a signature here :)
04-22-2009 11:21 AM
Profile PM Web Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: MySQL + Checkboxes
If you're using PHP it should look like:

PHP code:
<input type="checkbox" <?php if($row['field']==1) echo "checked=\"checked\""; ?> />

04-22-2009 11:46 AM
Profile PM Web Find Quote Report
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: MySQL + Checkboxes
I would suggest using some js to check them when the page is loaded, also depending on the application, you could just use graphics if it's just for display purposes and does not need to changed

[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














04-22-2009 11:47 AM
Profile E-Mail PM Find Quote Report
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. RE: MySQL + Checkboxes
quote:
Originally posted by Mnjul
If you're using PHP it should look like:

PHP code:
<input type="checkbox" <?php if($row['field']==1) echo "checked=\"checked\""; ?> />


Thats what im after, thanks ;)
...there used to be a signature here :)
04-22-2009 11:51 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On