Jump to content

Store Checkbox Values In Separate MySQL Fields


ryanewing

Recommended Posts

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!

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.