Accessing array value
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开发者_Go百科 array in C:\\htdocs\\apps\\u-antrag\\upload_form.php on line 97
Please, tell me where I made the mistake.
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
$fanr
is an object not an array. As such, use the ->
operator to access members.
echo $fanr->_attributes['value'];
精彩评论