Jump to content

Prevent Fatal Error on Non-Object


maxhugen

Recommended Posts

I have a php function that fills in a number of text boxes etc in a form.

 

However, there are several forms and web pages involved, and some forms will NOT have all of the text boxes.

 

Thus, I need my function to test if a control actually exists.

 

Currently, I do something like:

 

$Component->$grpatt->SetValue($db->f('attribute'));

 

If the text box control ($grpatt) doesn't exist, I get PHP Fatal error:  Call to a member function SetValue() on a non-object.

 

I looked at isset() but that doesn't seem right... and I couldn't get it to work when I tried it anyway.

 

I'm really stuck here, can't go any further till I fix this, so any suggestions would be most appreciated!

 

MTIA

Link to comment
https://forums.phpfreaks.com/topic/150975-prevent-fatal-error-on-non-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.