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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.