Recently I’ve come across a situation to where using a dynamic variable in a _POST setting is valuable, but it doesn’t seem to work. For example:
for($i = 0; $i<$limit; $i++){
if (isset($_POST['value_{$i}'])){
// do something
}
}
The values from _POST work fine; if I hard code a ‘1’ or a ‘2’ in there, I get my data. It just doesn’t seem to agree with the {$i} inside the _POST. Does anybody know why?
You need to use double quotes to parse variables in strings, eg
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double