Reputation: 1
i have this function
function ecr_form_save($data) {
/* data value
array(
['result'] =>
'ok'
)
*/
$result = validate_form($data);
global $firephp;
$firephp->log($result, 'Iterators');
//return $result; //return 1
if ($result['result']=="ok") {
return $result; //return 2
} else {
return $result; //return 3
}
}
When i uncoment return 1 everything works, but if i comment return 1 and try to get output from return 2 or 3 i get error
Any idea what is going on with that.
yes ,it is always is returning array like this array('result'=>'ok') or like this array('error'=>'"Beigu rādījums" ir jābūt veselam skaitlim') , depending on what input form has.
if i change if statement to if ( 1==1) it works to
Upvotes: 0
Views: 60
Reputation: 23244
Try changing your if statement to:
if( is_array($result) && isset($result['result']) && $result['result']=="ok" ){
Upvotes: 1
Reputation: 7946
I suggest you var_dump($result)
after 'return 1' - it might not be a true array.
Upvotes: 1