html - PHP in _POST data -


recently i've come across situation using dynamic variable in _post setting valuable, doesn't seem work. example:

for($i = 0; $i<$limit; $i++){ if (isset($_post['value_{$i}'])){ // } } 

the values _post work fine; if hard code '1' or '2' in there, data. doesn't seem agree {$i} inside _post. know why?

you need use double quotes parse variables in strings, eg

for($i = 0; $i<$limit; $i++){ if (isset($_post["value_{$i}"])){ // } } 

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -