[FX.php List] Trying to read back an array

Gjermund Gusland Thorsen ggt667 at gmail.com
Sun Sep 19 12:01:05 MDT 2010


Mine would look more or less like this:

               $_SESSION[$projectName][$recid]['description'] =
$_POST['description'] ;
               $_SESSION[$projectName][$recid]['type'] = $_POST['type'] ;
               $_SESSION[$projectName][$recid]['serial'] = $_POST['serial'] ;
               $_SESSION[$projectName][$recid]['problem'] = $_POST['problem'] ;

ggt

2010/9/17 Dale Bengston <dbengston at tds.net>:
> Stay with it! I fought with arrays for a long time before my brain snapped it into place and it all made sense. Now, I love 'em.
>
> Dale
>
> On Sep 17, 2010, at 9:33 AM, Bob Patin wrote:
>
>> Thanks Dale, Jonathan, and Leo!
>>
>> As you guys can see, my array knowledge is fleeting at best... I forget the simplest concepts like dimensioning...
>>
>> Ah well, on my way now, thanks guys!
>>
>> Bob
>>
>>
>> On Sep 17, 2010, at 9:26 AM, Dale Bengston wrote:
>>
>>> You probably don't need the last line, because that information is inferred from the top-level key of each $_SESSION element. I would also suggest making a sub-array in $_SESSION to hold this information instead of making it rattle around "loose" in there. (I called it 'bagel'.)
>>>
>>> // loop through the recid array and create the product arrays
>>> if( (strlen($_POST['recid'])>0) && (is_array($_POST['recid']))) {
>>>      foreach($_POST['recid'] as $recid) {
>>>              $_SESSION['bagel'][$recid]['description'] = $_POST['description'.$recid] ;
>>>              $_SESSION['bagel'][$recid]['type'] = $_POST['type'.$recid] ;
>>>              $_SESSION['bagel'][$recid]['serial'] = $_POST['serial'.$recid] ;
>>>              $_SESSION['bagel'][$recid]['problem'] = $_POST['problem'.$recid] ;
>>>      }
>>> }
>>>
>>>        // loop through the recid array and create requests for each item
>>>              foreach($_SESSION['bagel'] as $recid => $value) {
>>>                      $status = "Open; pending manufacturer approval";
>>>                      $description = $value['description'];
>>>                      $problem = $value['problem'];
>>>                      $serial = $value['serial'];
>>>                      echo $recid;
>>>              }
>>>
>>>
>>> Dale
>>>
>>>
>>>
>>>
>>> On Sep 17, 2010, at 9:08 AM, Bob Patin wrote:
>>>
>>>> So, one last couple of questions, and then I'll quit bothering you:
>>>>
>>>> To store these 5 vars into a single array, I have this:
>>>>
>>>> $_SESSION['recid']['description'] = $_POST['description'.$recid] ;
>>>> $_SESSION['recid']['type'] = $_POST['type'.$recid] ;
>>>> $_SESSION['recid']['serial'] = $_POST['serial'.$recid] ;
>>>> $_SESSION['recid']['problem'] = $_POST['problem'.$recid] ;
>>>> $_SESSION['recid']['recid']] = $recid ;
>>>>
>>>> I'm questioning the last line... is that right? Seems wrong...
>>>>
>>>> Thanks,
>>>>
>>>> BP
>>>>
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>


More information about the FX.php_List mailing list