Hi All
Any help you can give would be appreciated. I've had a look through similar problems that have been posted but have been unable to decipher how they apply to me.
I have a dynamic form that's created. From that form, two arrays are created:
question_number
answer_number
Each one is, I think, indexed as the form element is typically (I'm not looking at the code right now)
name="question_number[<?php $row_question['question_ID']?>"
I use this same numbering for the answers as well, which means the answer ID will match up to the question ID.
What I want to do is for each element of the form, submit that entry in the arrays into the database rows, into "question_number" and "answer_text", where that answer is related to that question
So far, I've been able to get either the question, or the answer, or all 30 answers per question (through a badly designed nested for eadh loop).
The following code gives me the question ids in the database, but leaves the answers blank at the moment - and I'm stuck as to how to proceed. Could anyone offer any advice please?
if (sizeof($_POST['question_number'])>0) {
foreach ($_POST['question_number'] as $question) {
$insertSQL = "INSERT INTO project_scorecard_answers (Aquestion_ID) VALUES ('$question')";
mysql_select_db($database_sciencewise, $sciencewise);
$Result1 = mysql_query($insertSQL, $sciencewise) or die(mysql_error());
}
}
I think I have to do something with the indexed numbers I've attached to each as the recordset ID, but don't know what!