How to get direct values for array post

[store_image] => Array ( [delete] => 1 [value] => test/1/test.jpg )

I am using this to get the value of check box

if ($main_images=$this->getRequest()->getPost('store_image')) 

but if check box is not checked it gives me Notice

Notice: Undefined index: delete

How to prevent from this notice Magento way?

1 Answer 1


You can update your code like this:

$delete = array_key_exists('delete', $main_images) ? $main_images['delete'] : false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.