Stop PHP from creating arrays in $_POST superglobal
Posted
by
cdmckay
on Stack Overflow
See other posts from Stack Overflow
or by cdmckay
Published on 2012-12-03T22:39:39Z
Indexed on
2012/12/03
23:05 UTC
Read the original article
Hit count: 223
PHP will automatically convert
<input type="text" name="foo[0]" value="x" />
<input type="text" name="foo[1]" value="y" />
into
$_POST['foo'] = array(
0 => 'x',
1 => 'y'
);
Which is what you want most of the time. However, in this case I would like this not to happen. Is there anyway to tell PHP to not do this?
I realize I could parse php://input
myself, but I'd rather not do that if I can avoid it.
I also don't have the option of renaming the input names.
© Stack Overflow or respective owner