Mmm, need to get this right in my head ....
.... firstly, I'm going to assume you have a user table, allowing the specified user admin rights to their own quiz:
[SQL]
CREATE TABLE tblUser (
UserId INT( 8 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
UserName VARCHAR( 50 ) NOT NULL ,
UNIQUE (UserName)
)
[/SQL[
You then have a table holding main quiz information, and the user having admin rights (you could include the number of questions for each individual quiz):
[SQL]
CREATE TABLE tblQuiz (
QuizId INT( 8 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
QuizName VARCHAR( 100 ) NOT NULL ,
UserId INT( 8 ) NOT NULL
)
[/SQL]
The following table will hold the questions for each quiz:
[SQL]
CREATE TABLE tblQuizQuestion (
QuizQuestionId INT( 8 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
QuizId INT( 8 ) NOT NULL ,
QuizQuestion VARCHAR( 255 ) NOT NULL ,
QuizResponseId INT( 8 ) NOT NULL
)
[/SQL]
And this table will hold the possible answers (QuizResponseId from tblQuizQuestion will point to one of these answers for each question):
[SQL]
CREATE TABLE tblQuizResponse (
QuizResponseId INT( 8 ) NOT NULL ,
QuizQuestionId INT( 8 ) NOT NULL ,
QuizResponse VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( QuizResponseId )
)
[/SQL]
Now the admin form that will build the questions and responses can be built quite easily, and can be used for both adding and amending question and responses. If you use arrays within the input form, they can be easily referenced within PHP once the form is posted (obviously you'll need to add a bit of formatting and labels to make the form look 'nice' !!).
<form name="frmQuizQuestion" action="..." method="post" target="_self">
<input type="hidden" name="QuizQuestionId" value="" />
<input type="text" name="QuizQuestion" value="..." />
<input type="text" name="QuizResponse[]" value="..." />
<input type="text" name="QuizResponse[]" value="..." />
<input type="text" name="QuizResponse[]" value="..." />
<input type="submit" name="btnSubmit" value="Save Question" />
</form>
The information submitted can be easily looped through:
for ($i=0; $i < count($_POST["QuizResponse"]; $i++) {
echo $_POST["QuizResponse"][$i];
}
Hopefully things are a little clearer - if not, post back with any questions.