cdoggg94 Posted February 22, 2013 Share Posted February 22, 2013 I have a form with a check box like this: <label> <input type="checkbox" name="CheckboxGroup1" value="Coaches" id="CheckboxGroup1_0" /> Coaches</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="Conveners" id="CheckboxGroup1_1" /> Conveners</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="Officials" id="CheckboxGroup1_2" /> Officials (Both)</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="Ref" id="CheckboxGroup1_2" /> Ref</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="Linesmen" id="CheckboxGroup1_2" /> Linesmen</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="Admin" id="CheckboxGroup1_3" /> Admin</label> <br /> <label> <input type="checkbox" name="CheckboxGroup1" value="All" id="CheckboxGroup1_4" /> All</label> Basically right now when I insert it, it accepts the lowest check box selected if multiple ones are checked. I was wondering: 1) How to accept ALL of the checked values instead of only the lowest. 2) What is the best way to handle the data...When I had a radio group, i had the information going into a column called "date_who". With that information I could choose which group of people saw the specific information in the table. I now want to be able to select multiple people but not "All". I guess the question is; should I have the information in one cell? (i.e - date_who = 'Coaches, Admin, Linesmen') or should i have a separate one for each ? (i.e date_coaches = 'Coaches' , date_converners = '' , date_officials = '' , date_ref = '' , date_linesmen = 'Linesmen' , date_admin = 'Admin' , date_all = '') Attached is an image that might help explain it a little Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/ Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 The name needs to be an array. CheckboxGroup1[] For the rest of your question, look up "Data Normalization". Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414134 Share on other sites More sharing options...
cdoggg94 Posted February 22, 2013 Author Share Posted February 22, 2013 Looking into it. Thank you Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414137 Share on other sites More sharing options...
cdoggg94 Posted February 22, 2013 Author Share Posted February 22, 2013 With the data normalization, it basically says in my case that it would be best to add them like this: (if coaches, officials and admin are selected..) it inserts as 3 entries, one for each date_who value What do i call that type of insert? or i guess how do i tell the insert to add 3 entries instead of 1 ? Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414138 Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 You need to create a new table that holds the ID of the parent entry and the type selected. you'd do three new rows in it, one for each, all with the same parent ID. Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414139 Share on other sites More sharing options...
cdoggg94 Posted February 22, 2013 Author Share Posted February 22, 2013 Sorry if my questions are annoying, but I just want to be clear.. Basically i would have an insert to the same table i have now, inserting the same content. Then have another table which holds the ID number of the new entry in the old table, the type, and its own ID ? Does that sound right ? Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414144 Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 Yes! Good job Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414146 Share on other sites More sharing options...
cdoggg94 Posted February 22, 2013 Author Share Posted February 22, 2013 Thank you for the help! I have one more question though.. Do I still need the "date_who" column in the old table ? Seems like I don't... Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414153 Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 Nope! Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414154 Share on other sites More sharing options...
cdoggg94 Posted February 22, 2013 Author Share Posted February 22, 2013 ok thanks again Link to comment https://forums.phpfreaks.com/topic/274819-check-box-group-insert-how-to-handle-the-data/#findComment-1414157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.