troubleshooting Question

php mysql multiple checkbox insert

Avatar of jonofat
jonofat asked on
PHPMySQL Server
15 Comments3 Solutions778 ViewsLast Modified:
Hi, I have 2 fields where the user can choose from a-d via checkboxes. Some jobs require all, some don't, etc. What would be the best way to capture this data in a database bearing in mind that it needs to be evaluated at a later stage by job per field. So, if I choose A and B which would be a better way of capturing the data? Either one row with a field showing something like A,B or have two rows added because 2 choices were made? I find it pretty confusing. Anyway, here is the form code.

<form id="form1" name="form1" method="post" action="">
  <p>Job no: 
    <label for="textfield"></label>
  <input type="text" name="textfield" id="textfield" />
  </p>
  <p>Weld : A
    <input type="checkbox" name="checkbox" id="checkbox" />
    <label for="checkbox"></label>
  B
  <input type="checkbox" name="checkbox2" id="checkbox2" />
  <label for="checkbox2"></label> 
  C
  <input type="checkbox" name="checkbox3" id="checkbox3" />
  <label for="checkbox3"></label>
  D
  <input type="checkbox" name="checkbox4" id="checkbox4" />
  <label for="checkbox4"></label>
  <br />
  </p>
  <p>Seal: A
    <input type="checkbox" name="checkbox5" id="checkbox5" />
    <label for="checkbox5"></label>
    B 
    <input type="checkbox" name="checkbox6" id="checkbox6" />
    <label for="checkbox6"></label>
  C
  <input type="checkbox" name="checkbox7" id="checkbox7" />
  <label for="checkbox7"></label>
  D 
  <input type="checkbox" name="checkbox8" id="checkbox8" />
  <label for="checkbox8"></label>
  </p>
  <p>
    <input type="submit" name="button" id="button" value="Submit" />
  </p>
</form>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros