0

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...

1
  • Single quotes parse literal strings! Commented Sep 9, 2013 at 22:38

1 Answer 1

2

Maybe you mean:

$_POST['u'][$number] = $number2;

Without single quote. Or even:

$_POST['u']["{$number}"] = $number2; //> Discouraged
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.