Randomize a set of data from a form and format results.

I would like to make a randomizer for show results but have no idea where to start. I have created randomizers that score based on a number where you have to input each competitor separately but am looking for something that does this:

ENTER ENTRIES INTO FORM WITH EACH CLASS SEPARATED BY A “|”, only the entrants should be randomized, not the order of classes:
|Class One
Entrant A
Entrant B
Entrant C
Entrant D

|Class Two
Entrant A
Entrant B
Entrant C
Entrant D

etc.

THEN SHOW THE RESULTS IN A SPECIFIC FORMAT AS FOLLOWS

Class A

  1. Entrant C
  2. Entrant A
  3. Entrant B
  4. Entrant D

Class B

  1. Entrant A
  2. Entrant D
  3. Entrant B
  4. Entrant C

Should I use the shuffle function? Am I totally off base on that idea and if so what would you recommend? Anyone know of any examples online to help me figure this out (I have searched and have been unsuccessful in finding anything).

How do you have the participants stored now? and what code do you use now to display it?

They wouldn’t be stored anywhere. It would be a web based form. An example would be like:

http://mayakenedy.com/phptest/rand/

I wouldn’t need all the options below, just the main textarea. Now that I’m thinking about it… is this maybe something that is not PHP based? I had assumed it was but maybe I’m wrong.

it can be done, but if its not being stored, whats the point?

I don’t need them to be stored (and the example site I linked above doesn’t store them either). The results are copy/pasted into a forum. That is all I need to be done. Can you point me in the right direction on how I can go about this task?

Well, i’d use a multidimensional array, something like

$classes = array(‘class’ => Class A, array(‘questions’ =>
‘q1’ => ‘1. Entrant C’,
‘q2’ => ‘2. Entrant A’,
‘q3’ => ‘3. Entrant B’,
‘q4’ => ‘4. Entrant D’)
);

Then you’d just need a foreach loop to run through all of them.

Sponsor our Newsletter | Privacy Policy | Terms of Service