Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:52:43+00:00 2026-05-23T14:52:43+00:00

I get the array data like this: $tags = $_GET[‘item’][‘tags’]; if ($tags){ foreach ($tags

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:52:44+00:00Added an answer on May 23, 2026 at 2:52 pm

    You need to do this:

    $tags = isset($_GET['item']['tags']) ? $_GET['item']['tags'] :'';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I normally get Facebook JSON data that look like this (taken from an example):
How can I get JSON array from Ext.data.Store outside the function? The code: var
I would like to be able to get html-formatted data from mysql, and turn
I obtained the data from the server using ajax like this: (EDITED) $(document).ready(function() {
I use this function below to process the array data I retrieve from my
I am having problem with $_GET array. More precisely I'm retrieving data from mysql
Currently I'm using file_get_contents() to submit GET data to an array of sites, but
My code: $.get('ajax/time_menus.php', { shift: $('#shifts').val() }, function(data) { //load the array into a
How do I get this array: Array ( [0] => Array ( [max] =>
How can I get an array of values from an associative array ? Associate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.