KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If you have an associative array: Array ( [uid] => Marvelous [status] => 1 [set_later] => Array ( [0] => 1 [1] => 0 ) [op] => Submit [submit] => Submit ) And you want to access the 2nd item, how would you do it? $arr[1] doesn't seem to be working: foreach ($form_state['values']['set_later'] as $fieldKey => $setLater) { if (! $setLater) { $valueForAll = $form_state['values'][$fieldKey]; $_SESSION[SET_NOW_KEY][array_search($valueForAll, $form_state['values'])] = $valueForAll; // this isn't getting the value properly } } This code is supposed to produce: $_SESSION[SET_NOW_KEY]['status'] = 1 But it just produces a blank entry.
Tags (comma-separated)
Save Edits
Cancel