Online examinatin System in PHP

I am doing an assignment given to me by a teacher.

I am making online examination system. I am giving you a short info.

For this purpose i have 3 login names,

1- Admin, 2- Teacher, 3- Student

I am currently working on the Teachers page.

Teacher enters : prog title from list. semester from list. enters subject

name,firstname,lastname and password.

I have 3 programes BBA,BBA-IT,BCS. Now for each programe there are 8 semesters.

I want teacher to make paper online, which kind of paper? MCQ’S Type.

So there will be a total of 83=24 tables for each paper (semprog). And it will be

very time wasting and frustrating making 24 tables.

So from my point of view i wanna create those tables dynamically.

On the basis of the prog title, subject, semester from the login page the table will be

created. why subject,semeter,prog title? bcoz they are UNIQUE.

Next to teachers login page: I have created a page with the following text.

Enter No of Questions : textbox

if teacher enter’s 5 and Clicks the Proceed or Next Button. the following page creates

with 5 textboxes on every row for each question or simply loops do that job :

Q# Question Choice_1 Choice_2 Choice_3 Ture_Ans
0. textbox textbox textbox textbox textbox

  1.            textbox                 textbox      textbox     textbox       textbox 2.                textbox                 textbox      textbox     textbox       textbox 3.                textbox                 textbox      textbox     textbox       textbox 4.                textbox                 textbox      textbox     textbox     textbox   
    

Teacher enter’s questions with multiple choices and the true answer and when he/she clicks the proceed button they are added to the table that is dynamically created by subject,sem,prog.

Uptil Now i have worked fine.

When these question’s are added to the database, The preview of paper will be shown to the teacher. Now here i have problem. How to select and view all the questions from the database. I want to select all these questions from the database dynamically in the following format:

Q# Question Choice_1 Choice_2 Choice_3 Ture_Ans
0.

  1.          |                                                                               |
    
  2.          |         HERE WILL BE THE DATA                                     |
    
  3.          |                                                                               | 
    

If there are 5 questions in database preview of 5 questions will be show if there are 10 questions preivew of 10 questions will be shown. In short dynamic preview will be shown to the teacher, with the EDIT button. If he click the Edit button he will EDIT and then UPDATE the Paper.

Another problem is when teacher logins again with the same prog title, sem, subject a table of that name is already created so it gives error that table already exists.

For this error i have entered the following query but it doesn’t works:

$sql =“DROP if table $post[prog]$post[sem]$_post[sub] exists”;

$sql=“create table $post[prog]$post[sem]$_post[sub] and so on…”;

I will be very thankfull who help me.