Well, I was working on this one project, on the assumption that I could get the values of all elements with the same name from an appropriately named array. Well, I was *very* disappointed when I couldn't, so I made it so I did anyway.
The following script should convert the raw post data to a $_POST variable, with form data from SELECT elements and their ilk being transformed into an array. It's heavily unoptimized, and I probably missed something, but it's relatively easy to read. I welcome corrections.
<?php
if ($_POST) {
$postdata = file_get_contents('php://input');
$uglybugger = '/(?<=&)([^&=]+)(?:=([^&]*))/';
$matches = array();
preg_match_all($uglybugger, $postdata, $matches);
$_POST = array();
$match_count = count($matches[0]);
for ($i = 0; $i < $match_count; $i++) {
if (!isset($_POST[$matches[1][$i]])) {
$_POST[$matches[1][$i]] = array();
}
$_POST[$matches[1][$i]][] = $matches[2][$i];
}
$match_count = count($_POST);
for ($i = 0; $i < $match_count; $i++) {
if (count($_POST[$i]) == 1) {
$_POST[$i] = $_POST[$i][0];
}
}
}
?>