I get the array data like this:
$tags = $_GET['item']['tags'];
if ($tags){
foreach ($tags as $tag){
As the tags data is sent from an input field, which can be empty as well. So in case if $tags doesn’t get any data, i get the following notice:
Message: Undefined index: item
How can I avoid this notice?
if i try this:
$tags = isset($_GET['item']['tags']);
Then if $tags does not get any data, it does not show any warning, but if it gets any data then i get following warning:
Message: Invalid argument supplied for foreach()
How can I do it so that if $tags get any data then go to foreach loop, otherwise don’t give any notice that it didnt get any data.
Thanks.
You need to do this: