ryanewing Posted December 24, 2007 Share Posted December 24, 2007 I have some checkboxes in a form. When the form is submitted, I need the checked boxes to be stored in separate fields in a database based on the email that is currently held in session. The user will select no more than 4 textboxes, and I have 4 fields in my database called event1, event2, event3, and event4. What I need help with is taking the values from the checked boxes and inserting it into the event fields. My form is this: <form method="post" action="eventadd.php"> Select the events you want<br> <input name="event[]" type="checkbox" value="fbla"> fbla<br> <input name="event[]" type="checkbox" value="business"> business<br> <input name="event[]" type="checkbox" value="ryan"> ryan<br> <input name="event[]" type="checkbox" value="design"> design<br> <input name="event[]" type="checkbox" value="C++"> C++<br> <input name="send" type="submit" id="send" value="Send!"> </form> Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/82995-store-checkbox-values-in-separate-mysql-fields/ Share on other sites More sharing options...
trq Posted December 24, 2007 Share Posted December 24, 2007 I have 4 fields in my database called event1, event2, event3, and event4 This is poor db design from the get go. There is a link in my signiture to a free book, within the database chapter of that book is a section on normalization, you should read it. Quote Link to comment https://forums.phpfreaks.com/topic/82995-store-checkbox-values-in-separate-mysql-fields/#findComment-422144 Share on other sites More sharing options...
ryanewing Posted December 24, 2007 Author Share Posted December 24, 2007 So I should have another table, just for events? fbla business php101 1[/td] 1 2 and have another column in my users table, like event_num that would have have a unique id number? Quote Link to comment https://forums.phpfreaks.com/topic/82995-store-checkbox-values-in-separate-mysql-fields/#findComment-422214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.