Kinda a neat trick that works with php (in my limited, MAMP-only testing):

<?php
if (isset($_POST['test'])) {
foreach($_POST['test'] as $key => $x) {
echo $key . "::" . $x . "<br>\n";
}
} else {
echo "Enter values.<br>\n";
}
?>

<form method="POST">
<input type="text" value="dude" name="test[1]"><br>
<input type="text" value="dude" name="test[3]"><br>
<input type="text" value="dude" name="test[5]"><br>
<input type="text" value="dude" name="test[8]"><br>
<input type="text" value="dude" name="test[9]"><br>
<input type="text" value="dude" name="test[2]"><br>

<input type="submit"><br>
</form>


Output is...
1::dude
3::dude
5::dude
8::dude
9::dude
2::dude


That gives you a lot more control than just having test[] for your form element names. So in one page, I want to know the id numbers of the elements that are selected. Now I can put that information in the index of the array and pass a value (in this case, a user-inputed ordinal reflecting the display order of the elements) as well.

Labels: , ,