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]

 

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

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.