I'm using the code below to populate and persist data in 4 related dropdown boxes. The dropdown boxes are for 4 conferences and the users are asked to rate each of them as 1st, 2nd, 3rd and 4th choices. I'd like to take the data and display it in the order they chose -- so like if they rated conference 3 as their first choice and conference 1 as their second choice, something like this could be displayed:
Your choices:
First Choice: Conference 3
Second Choice: Conference 1
etc.
I also need to take this same data and work out a validation on submit so they can't have more than one of any choice (can't have 2 first choices, etc.). Here's the code -- any help on either issue will be appreciated:
$saForm = '
<select name="preConSA1">
<option value="' . $_SESSION['preConSA1'] . '">';
if ($_SESSION["preConSA1"] == 1) {
$saForm .= "1st Choice";
} else if ($_SESSION["preConSA1"] == 2) {
$saForm .= "2nd Choice";
} else if ($_SESSION["preConSA1"] == 3) {
$saForm .= "3rd Choice";
} else if ($_SESSION["preConSA1"] == 4) {
$saForm .= "4th Choice";
}
$saForm .= '<option value="1">1st Choice
<option value="2">2nd Choice
<option value="3">3rd Choice
<option value="4">4th Choice
</select> <h2 class="italic">Session 1: Preverbal and Verbal Conversation</h2><br>
<select name="preConSA2">
<option value="' . $_SESSION['preConSA2'] . '">';
if ($_SESSION["preConSA2"] == 1) {
$saForm .= "1st Choice";
} else if ($_SESSION["preConSA2"] == 2) {
$saForm .= "2nd Choice";
} else if ($_SESSION["preConSA2"] == 3) {
$saForm .= "3rd Choice";
} else if ($_SESSION["preConSA2"] == 4) {
$saForm .= "4th Choice";
}
$saForm .= '<option value="1">1st Choice
<option value="2">2nd Choice
<option value="3">3rd Choice
<option value="4">4th Choice
</select> <h2 class="italic">Session 2: Growing Up and Growing Older</h2><br>
<select name="preConSA3">
<option value="' . $_SESSION['preConSA3'] . '">';
if ($_SESSION["preConSA3"] == 1) {
$saForm .= "1st Choice";
} else if ($_SESSION["preConSA3"] == 2) {
$saForm .= "2nd Choice";
} else if ($_SESSION["preConSA3"] == 3) {
$saForm .= "3rd Choice";
} else if ($_SESSION["preConSA3"] == 4) {
$saForm .= "4th Choice";
}
$saForm .= '<option value="1">1st Choice
<option value="2">2nd Choice
<option value="3">3rd Choice
<option value="4">4th Choice
</select> <h2 class="italic">Session 3: Parent Group Leadership Seminar</h2><br>
<select name="preConSA4">
<option value="' . $_SESSION['preConSA4'] . '">';
if ($_SESSION["preConSA4"] == 1) {
$saForm .= "1st Choice";
} else if ($_SESSION["preConSA4"] == 2) {
$saForm .= "2nd Choice";
} else if ($_SESSION["preConSA4"] == 3) {
$saForm .= "3rd Choice";
} else if ($_SESSION["preConSA4"] == 4) {
$saForm .= "4th Choice";
}
$saForm .= '<option value="1">1st Choice
<option value="2">2nd Choice
<option value="3">3rd Choice
<option value="4">4th Choice
</select> <h2 class="italic">Session 4: General Pre-Conference</h2><br><br>';