Welcome Guest, Not a member yet? Register   Sign In
[HELP] Form Generation Library (radiogroup )
#2

[eluser]S-Vizion Software and Development[/eluser]
Could you post some more of your code?

A undefined index means your array does not have a key named whatever your error is try something like below

Code:
// Type Cast Variable Data as a Array
$data = (array) $data;

// First check there is a Array Key named 'isInMain' and then check it's not empty
if (array_key_exists('isInMain', $data) && !empty($data['isInMain'])
{
  // Set Object Key to the Data
  $news->isInMain = $data['isInMain'];
}

if (array_key_exists('isActive', $data) && !empty($data['isActive'])
{
  $news->isInMain = $data['isActive'];
}

if (array_key_exists('can_comment', $data) && !empty($data['can_comment'])
{
  $news->can_comment = $data['can_comment'];
}

I personally use a helper function myself that I wrote along time ago to verify that the variable I'm checking is set, not empty, etc to reduce having to write so much extra code checking.

Hopefully that will help you get on the correct track.


Messages In This Thread
[HELP] Form Generation Library (radiogroup ) - by El Forum - 05-01-2012, 05:27 PM
[HELP] Form Generation Library (radiogroup ) - by El Forum - 05-01-2012, 08:16 PM
[HELP] Form Generation Library (radiogroup ) - by El Forum - 05-01-2012, 08:29 PM
[HELP] Form Generation Library (radiogroup ) - by El Forum - 05-02-2012, 06:36 AM
[HELP] Form Generation Library (radiogroup ) - by El Forum - 05-02-2012, 06:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB