I have a form that has two event options, each event has 3 different items each and each item has 2-3 participants.
Event 1
- Football – John, Mike, Sam
- Cricket – Sam, Henry
- Chess – Ross,Mike
Event 2
- Guitar – Sam, Phillip
- Drum – Steve, Ross
- Piano – Mike, John
<form>
<div>
<h1>Select Event 1</h1>
<select>
<option>Football</option>
<option>Cricket</option>
<option>Chess</option>
</select>
</div>
<div>
<h1>Select Event 2</h1>
<select>
<option>Guitar</option>
<option>Drum</option>
<option>Piano</option>
</select>
</div>
<input type="submit" />
</form>
How do I generate a result that makes a list of people who are involved on those selected items and he who has maximum participation among those events appears first and then the rest. Like, when someone selects 'Football' from Event 1 and 'Guitar' from Event 2, after submission, the result will be –
Participants
- Sam
- Henry, Phillip
How do I set the values of the options and how php or javascript can help me generate the result?