There should be at two tables for the basics; one table for questions and the other for the answers.
This is the over-simplified version; not in any particular flavor of SQL, and there are no keys or indexes installed (but recommended)
CREATE TABLE mcqQuestions (
QuestionID INT,
QuestiontEXT NVARCHAR(100)
)
CREATE TABLE mcqAnswers (
AnswerID INT,
QuestionID INT,
AnswerCorrect BIT,
AnswerText NVARCHAR(100)
)
Now on the HTML side; the form I would use would have the question an answers, along with a
radio button for marking which answer is correct. If you make sure they are on the same form and all have the same name, only one of them can be checked at any give time. The differentiation is done be the assigned value
<form action="http://www.Example.com" method="post">
<input type="text" name="Question" />
<br>
<input type="radio" name="CorrectAnswer" value="1" />
<input type="text" name="Answer1" />
<br>
<input type="radio" name="CorrectAnswer" value="2" />
<input type="text" name="Answer2" />
<br>
<input type="radio" name="CorrectAnswer" value="3" />
<input type="text" name="Answer3" />
<br>
<input type="radio" name="CorrectAnswer" value="4" />
<input type="text" name="Answer4" />
<br>
<input type="submit" />
</form>
Pressing the submit button on this will POST the following data:
Question: {text from input}
Answer1: {text from input}
Answer2: {text from input}
Answer3: {text from input}
Answer4: {text from input}
CorrectAnswer: {one of the four values assigned in the source code}
Sorry but I do not write PHP... but the logic is relatively simple:
1. Read the question
2. Save the question to the DB and get it's ID
3. Read the CorrectAnswer value.
4. Read all 4 answers
Save each answer individually, using the respective input element and questionID (from #2), AND if it the correct answer save that as well