Following this post I've created the following html passing arrays as an input element attribute:
...
<input type="text" name="setValues[cardExpiration]" id="card_expiry" class="input-small" value="1222">
<input type="text" name="setValues[ipAddress]" id="ip" value="24.37.246.194">
...
After the form is submitted we will have the following multi-dimensional array inside $_POST
:
Perceivewithvar_dump()
thekeysoftheinternalarray:
echo'<pre>';var_dump($_POST);echo'</pre>';
Whenwetrytoretrievethevaluesthisiswhathappens:
$email=(isset($_POST["setValues"])?$_POST["setValues"]["email"]:FALSE);//NULL
$email = (isset($_POST["setValues"])?$_POST["setValues"]["'email'"]:FALSE);//Retorna o e-mail preenchido no formulário
The center point here is the ' key ' tag that is being created within the array key.
That's why $_POST["setValues"]["'email'"]
works and $_POST["setValues"]["email"]
does not work, returns NULL.
So my question is how could we create this array within the input attribute without these single quotes appearing in the key?