Reputation: 922
I understand how to set POST variables ($_POST['u'] = 10
), and I understand how to call a multi-demensional post value ($_POST['u']['number2']
), so to set a simple multi-demensional POST, it'd be simple ($_POST['u']['number2'] = 10
).
The problem comes when I need to set a POST variable by use of a variable, i.e., $_POST['u']['$number'] = $number2
, where $number
is a string from a loop.
What's going on is the loop takes data from the POST[u][$number], manipulates it, spits out $number2, and I'm wanting to update the POST[u][$number] with $number2, if that makes any sense.
So, basically, is there anyway for me to do $_POST['u']['$number'] = $number2
?
I tried using eval
but that didn't work...
Upvotes: 0
Views: 19
Reputation: 48141
Maybe you mean:
$_POST['u'][$number] = $number2;
Without single quote. Or even:
$_POST['u']["{$number}"] = $number2; //> Discouraged
Upvotes: 2