Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Question and Answer system, help needed with insert

Avatar of Westside2004
Westside2004Flag for United States of America asked on
Web Servers
4 Comments1 Solution225 ViewsLast Modified:
Hi,

I have this Question and Answer system I am building.  All the questions are stored in the database.  I also have an "Answer" table that stores the answer to each question and it also stores the "jobApplication_id" that the answer is associated with.

Answer table:
answerId (int, auto increment)
answer (text)
questionId(int)
jobApplication_id(int, FK)

When the form is submitted I see this when I dump the #FORM# scope:

<cfdump var="#form#">
------------------------------------------
QUESTIONID1         1
QUESTIONID2       2

ANSWER1         answer to question 1
ANSWER2       answer question 2

NUMQUESTIONS 2
-------------------------------------------

In the actual HTML form, I loop over the questions and display them so a question_id is available.  I then appended the "questionId" to the ncessary form fields to make them unique.

How can I loop over the formfields and insert the relevant answer to the question into the "Answer" table and also insert the associated questionId that goes with that answer.  I seem to be having a problem with the relationship between the question and the answer.

Any help appreciated

-ws

ASKER CERTIFIED SOLUTION
Avatar of bwasyliuk
bwasyliuk

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers