code help for implementing online exam please

Hi, I have been trying to write code for making an online exam management system. I could not think about a logic to implement the actual exam. Here is the problem: I have a questions table with fields like- id, question, opt1, opt2, opt3, opt4 and correctans. I want to read all the records from this table but I want to display only one record at a time for user to answer the question. User then clicks next to see the next question and choices and so on till the end of the records. I don't know how to implement this. I did @questions=Question.find(:all) Now how can I use this @questions and display only one record at a time so that user answers the question and then I can do something to store the user response?

OR if I am wrong, please suggest good logic to implement this.

Thanks

First of all, online exam must be have category of exam. each exam must be up to date and never the same each date. out of your case i would like to try my mind in this case now.

Rails Terrorist wrote:

Rails Terrorist wrote:   if @user_answer.save   session[:id_questions] = session[:id_questions] - @used_id     if session[:id_questions].blank?        redirect_to :action=> :complete_page     else        redirect_to :action=> :next_question, :id=> session[:id_questions].first, :last_page_id => @used_id     end

the correct is :

redirect_to :action=> :next_question, :id=> session[:id_questions].first[0], :last_page_id => @used_id[0]

if you find any error, keep post it, I will review back when I'm online. :slight_smile:

I hope some my brothers can develop my code and give good suggestion

Have nice weekend Y. Reinhart A P Blog : teapoci.blogspot.com

Rails Terrorist wrote:

Rails Terrorist wrote:

Rails Terrorist wrote:   if @user_answer.save   session[:id_questions] = session[:id_questions] - @used_id     if session[:id_questions].blank?        redirect_to :action=> :complete_page     else        redirect_to :action=> :next_question, :id=> session[:id_questions].first, :last_page_id => @used_id     end

the correct is :

redirect_to :action=> :next_question, :id=> session[:id_questions].first[0], :last_page_id => @used_id[0]

if you find any error, keep post it, I will review back when I'm online. :slight_smile:

I hope some my brothers can develop my code and give good suggestion from my code or maybe can provide new code. :slight_smile:

Have nice weekend Y. Reinhart A P Blog : teapoci.blogspot.com

Thank you brother. You helped me a lot. I did it.. Actually I was implementing someting too simple with single table for practice. But now I will use multiple tables with relations and a real working implementation.

Thanks Great job. Keep doing.