How to hold values while clicking on next button. Urgent please?

Hello friends I am new in PHP.
I am creating a project on online examination. I am able to retrieve questions randomly from database. But please tell me when I click on next button how I hold the question id and answer given by the user. Suppose I prepare exam for 50 questions so how I hold this values. I want to insert answers of all the question into database after finish the exam. So think for this I have to use session but I don't know how.
Please help me its urgent.
