If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Hmm I'm not quite sure if I go it. Is it possible to achieve same result without a restart button?

I can briefly explain my concept:
I have a main page where I click on a link and random questions start to pop up (questions are on sepperate .html pages with submit buttons to go to the next question). I made a .php file and added this code so I could randomize certain amount of questions and then redirect to main page again. Now everything works fine and does what I need, thanks to all the help

I was just conserned that If I close the questions' page, and then click on the link again then it does't open me questions' page anymore, but openes me the page where it is already redirected. It might not be a problem. But I was just thinking if someone wants to answer them again, they wouldn't probably think of deleting the cookies or closing the browser.

Well you'd need some kind of user input to give the user the choice to start over. A button seemed most appropriate.

Providing each of your question pages used the session, then you could place that restart submit button on the same page with the next button. All this would do is unset the session variable and thus restart the questions.

You could even have a 'finish page' with that submit button saying something like "You have completed all the questions, click here to start again".

Last edited by dan-dan; 07-02-2012 at 10:38 PM.

Logic will get you from A to B. Imagination will take you everywhere.Albert Einstein

I would have one last and tiny question: now the code is written to take all the questions from the folder and randomly output them.
In what place and what would be the right code snipet to add to take, for example, only 10 questions out of 20?

Actually it only made the code visible on the background of the questions (showing on what question I am and how many left etc). It didn't give me an opportunity to have only few questions out of 20, even if I changed that 0 in the end of that 'page' session o 10. But I probably did it wrong?

Sorry my bad, again I misread. So you want to allow the user to choose a specific amount of questions to answer? How would you want this presented? Drop down, text input etc?

No problem. I apologize if I can't explain myself very well.

That is also not exactly what I want.

Let's say I have for example 40 pages in the folder, and now what my php code does, is shows all of the pages randomly, without repeating and when all 40 are shown, it redirects to randompage.com.

What I would like, if it is possible, that the code would automatically choose only random 20 of those 40 pages to show randomly (so there is more chance each time when someone answers, that different questions pop up) and then redirect to randompage.com

Does it sound more clear? English is not my native language, it might sound clear to me, but weird to someone else

But whether you choose 20 or 40 questions they're all still random, and they're all still only going to occur once per session. Unless I'm missing something here (which is very likely ) it seems like a pointless task.

Logic will get you from A to B. Imagination will take you everywhere.Albert Einstein

But whether you choose 20 or 40 questions they're all still random, and they're all still only going to occur once per session. Unless I'm missing something here (which is very likely ) it seems like a pointless task.

Yap I want them to be random.

For example when I have 5 pages and only 2 are pulled
and one person answers the for the first time and gets pages:
1,3
if the same person for some reson wants to answer again, he or she might get pages:
5,2
and so on.

Maybe it is pointless though, im not sure yet But that would increase the chance that the person will get a new question not all the same as before
Is that possible? :P