Rifts Posted November 11, 2009 Share Posted November 11, 2009 Hi! When adding a new field to a table how do you know how to set it up for the Type | Collation | Attributes | Null | Default | Extra I know what to do if its a text field but Im trying to store checkboxes from my form, and im unsure of what to do. Link to comment https://forums.phpfreaks.com/topic/181157-super-noob-question/ Share on other sites More sharing options...
Daniel0 Posted November 11, 2009 Share Posted November 11, 2009 There is no one-to-one correspondence between a MySQL database and a set of HTML checkboxes. How you would want to store it depends on the nature of the data. Link to comment https://forums.phpfreaks.com/topic/181157-super-noob-question/#findComment-955742 Share on other sites More sharing options...
Rifts Posted November 11, 2009 Author Share Posted November 11, 2009 ok say there were 4 checkboxes, red, blue, green, and any color. Would I use true-false to see if there are checked or not? What would the best way be? Link to comment https://forums.phpfreaks.com/topic/181157-super-noob-question/#findComment-955744 Share on other sites More sharing options...
Dragen Posted November 11, 2009 Share Posted November 11, 2009 If you have one column for each colour, red, blue, green, any, then I would suggest having them all as BOOLEAN type. That way you can simply store true, if they are checked or false if not. Link to comment https://forums.phpfreaks.com/topic/181157-super-noob-question/#findComment-955781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.