PHP not converting form inputs with square brackets in names to arrays -
i'm working on form looks this:
<form id="add_to_basket" action="" method="post"> <select name="option[10]"> <option value="1">red</option> <option value="2">silver</option> </select> <select name="option[11]"> <option value="a">metallic</option> <option value="b">colour changing</option> </select> </form>
the form validated , submitted javascript , processed php script. on live server form works , values captured correctly, , if use var_dump() contents of $_post see this:
array(1) { ["option"]=> array(2) { [10]=> string(1) "1" [11]=> string(1) "a" } }
but when same thing on local server see this:
array(1) { ["option"]=> string(0) "" }
i've omitted other input fields none of them has "option" in id or name.
is possible version of php isn't configured correctly this, or default behaviour , it's supposed work? live server uses php 5.2 (xampp) , local server uses php 5.3.5 (mamp).
thank assistance or comments.
php parse parse_str() function uses 1 setting deprecated
so check magic_quotes_gpc
setting both on local , remote , compare.
look closely how parse_str()
parses sample string. can $_server['query_string']
, use parse_str()
on string , see result.
also check:
Comments
Post a Comment