<snip>
echo "<form method='get' action='exams2.php'>";
$Student = array ("albert Einstein", "Ivan the Terrible", "Napolon",
"Simon Bolivar", "Issac Newton");
while(list(,$name)=each($Student)){
echo "what grade did $name get in Maths?";
echo"<br><br>";
echo "<select name='Math[]'>
<option>Grade A</option>
<option>Grade B</option>
<option>Grade C</option>
<option>Grade D</option>
<option>Grade E</option>
</select>";
echo "<br><br>";
echo "<input type='hidden' name='Student[]' value='$name'>";
}
echo "<input type='submit'></form>";
Here is the processing code:
$Math = $_REQUEST["Math"];
$Student[] = $_REQUEST["Student"];
while(list($index, $value)=each($Math)){
$gradeStudent[]=$Math[$index].$Student[$index];
}
Asort($gradeStudent);
while(list($index, $value) = each($gradeStudent)){
echo"<br>$Student[$index] - $Math[$index]";
}
</snip>
Hmm, that code works for me. what does the output look like if you do
a print_r on the $_REQUEST array on the exams2.php page?
Also, take a look at the foreach loop http://www.php.net/foreach .
I think you might like that for looping through your arrays
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php