Jump to content

PHP How to process each checkbox ( checked) as a new row in MYSQL


jamesbezza

Recommended Posts

Hi there

 

I am having to implement a relational database structure as part of my DB assignment for my Software development degree, with the front end being a realistic customer interface

which asks potential applicants to submit their details and course selections

 

( a web form for potential applicants to submit details and chosen courses which is in a list of check boxes[array] )

 

url of webform  http://cd.bromley.ac.uk/jamesb/kipm.php

 

  so when submitted the form  is processed by a PHP script and then the form data input is stored in a MYSQL database, i am using 3 tables  delegate, booking, course  which in theory is a one to many relationship a delegate may make many bookings but a booking must be associated with a least one delegate and a booking may have many courses but a booking must be associated with at least one course etc..

 

I have an issue with being able to store each checked course option as a new row in MYSQL under the same DB field CourseRef

 

my query is sending  the form data  to their relevant tables as listed above but i am serializing the courseRef which is being stored in the courseRef field like so

 

a:3:{i:0;s:3:"OD1";i:1;s:3:"JA1";i:2;s:3:"C+1";}  i would like each  course selection to populate a new row with each selection ie

 

  booking table

(primary key)

bookingnum        courseRef field

1                            od1

1                            ja1

1                            c+1

 

Any help with this would be greatly appreciated

 

James Berry  i have attached my php script submit_entry.php

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

 

Hi there

 

I am having to implement a relational database structure as part of my DB assignment for my Software development degree, with the front end being a realistic customer interface

which asks potential applicants to submit their details and course selections

 

( a web form for potential applicants to submit details and chosen courses which is in a list of check boxes[array] )

 

url of webform  http://cd.bromley.ac.uk/jamesb/kipm.php

 

  so when submitted the form  is processed by a PHP script and then the form data input is stored in a MYSQL database, i am using 3 tables  delegate, booking, course  which in theory is a one to many relationship a delegate may make many bookings but a booking must be associated with a least one delegate and a booking may have many courses but a course must be associated with at least one booking etc..

 

I have an issue with being able to store each checked course option as a new row in MYSQL under the same DB field CourseRef

 

my query is sending  the form data  to their relevant tables as listed above but i am serializing the courseRef which is being stored in the courseRef field like so

 

a:3:{i:0;s:3:"OD1";i:1;s:3:"JA1";i:2;s:3:"C+1";}  i would like each  course selection to populate a new row with each selection ie

 

  booking table

(primary key)

bookingnum        courseRef field

1                            od1

1                            ja1

1                            c+1

 

Any help with this would be greatly appreciated

 

James Berry  i have attached my php script submit_entry.php

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.