Hi I have a section where I am cloning a div for "Add another" button everytime it's clicked, the form fields are set as arrays. The query runs but saves nothing and just displays empty rows... can someone please tell me where could I be wrong?
<label for="GCSESubject[]">GCSE Subjects</label>
<select name="GCSESubject[]" id="GCSESubject[]" style="width: 178px; float: left; margin-right: 12px;">
<option value=""></option>
<?php echo getGCSESubjectsOptions(false, true);?>
</select>
Then I save it using these lines of code:
function saveGCSEEducation()
{
if (isset($_POST['saveGCSEEducation'])) {
$db = new Connection(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$GCSESubjectSerialized = serialize($_POST['GCSESubject']);
$GCSESubject=mysql_real_escape_string($GCSESubjectSerialized);
$userID = $_SESSION['user']['userID'];
$db->query('
INSERT INTO GCSEEducation
(userID, GCSESubject, GCSEGrade)
VALUES
("'.$userID.'", "'.$GCSESubject.'", "'.$GCSEGrade.'")
');
}
}