Quick question: if I submit a form like the following
<form action='something.php'>
<input type='text' name='a' />
<input type='text' name='a' />
</form>
what would $_GET['a'] output?
If the names end in []
it gives you an array, otherwise it gives you the last result.
$_GET['a']
would be the last or first parameter (I don't remember).
You have two options:
Either parse the string your self (can be done both with GET and POST)
use "a[]" as name. That will trigger PHP to populate $_GET['a']
as an array. However, this behavior is not standard and might give you problems with client side javascripting.
For parsing, either use (for GET)
$_SERVER['QUERY_STRING']
or (for POST)
file_get_contents("php://input")
php://input
is a stream which is equivalent to the raw body data of the request.