For your second problem, the main issue is that php data is not passed between pages unless you incorporate it into your form. On the second page, all the data that is sent by your form is held in the $_POST array. You can pass your users selections in this manner no problem, but the correct answers shouldn't be passed like this because they would be visible to anyone viewing the source of the page. These are a few things I would do in your place:
Firstly, you should only have one form tag which you should write outside the five times loop, with one submit button and the closing form tag after the 5 times loop finishes. This will then only post the page when all questions are answered, and will post all the answers at once.
Set the name of your
radio buttons to the outer loop iteration (the one that runs 5 times). Radio buttons of the same name will be grouped, and you can access a radio group with the name
group1 as $_POST['group1'] in your grade page.
When you select a random number in each loop iteration, remove the chosen index from your arrays with
splice. This will prevent you from accidentally displaying the same question twice. Append the random number in each iteration to a string, then after your loop has finished, create a
hidden input in your form with the string of random numbers as it's value. On the grade page, read in the answers text file, then for each group of radio buttons, splice the correct answer from your answers array using the numbers in the string. This will ensure that for each set of answers the array remains the same length and order as your questions and choices arrays did on the previous page.
Sorry I didn't have time to write any code here, but hopefully it's all understandable and gives you an idea of what you need to do next. Good luck!