According to the w3c \"Several checkboxes in a form may share the same control name. Thus, for example, checkboxes allow users to select several values for the same property.\"
That would never have worked without the []
, not in PHP.
W3C don't specify anything about how query strings are handled server-side. (Ignoring an irrelevant, obsolete corner of the CGI spec, only relevant to PHP in that it was a security hole up until recently).
It looks like that pattern is valid markup, but not commonly used, for the reason you describe.
A similar pattern is used for radio buttons, of which only one can be selected at a time. (In fact, giving the radio inputs the same name is how the browser knows to treat them as a group). Perhaps that's what you were thinking of.
If you really want it in PHP, try this:
<?php
if (count($_POST)) {
header("Content-type: text/plain");
$fp = fopen("php://input", "r");
fpassthru($fp);
fclose($fp);
exit;
}
?>
<form action="" method = "post">
<input type="checkbox" name="pet" value="dog" />Dog<br />
<input type="checkbox" name="pet" value="Cat" />Cat<br />
<input type="checkbox" name="pet" value="bird" />bird<br />
<input type="checkbox" name="pet" value="iguana" />iguana<br />
<input type="submit" />
</form>
More on php://input
stream can be found in PHP documentation.