views:

38

answers:

2

print_r($fanr);

results in:

HTML_QuickForm_text Object
(
    [_label] => FA-Nummer
    [_type] => text
    [_flagFrozen] => 
    [_persistantFreeze] => 1
    [_attributes] => Array
        (
            [name] => auftragsnr
            [type] => text
            [value] => 123
        )

    [_tabOffset] => 0
    [_tab] =>   
    [_lineEnd] => 

    [_comment] => 
)

trying to output the value of name with

echo $fanr["_attributes"]["value"];

Did not work. The error.log tells me

[Tue Oct 27 13:58:08 2009] [error] [client 127.0.0.1] PHP Fatal error:  Cannot use object of type HTML_QuickForm_text as array in C:\\htdocs\\apps\\u-antrag\\upload_form.php on line 97

Please, tell me where I made the mistake.

+2  A: 

$fanr is an object not an array. As such, use the -> operator to access members.

echo $fanr->_attributes['value'];
cletus
Thank you - the error.log shows it clearly. Time to visit my optician.
vbd
+3  A: 

your variable $fanr is an object, not an array. you have to use $fanr->_attributes['value'] to access its members.

alternatively you can implement the ArrayAccess interface

knittl