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 872441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:47:05+00:00 2026-05-15T10:47:05+00:00

$_GET variable cannot identify the first array element.: I have passed an array in

  • 0

$_GET variable cannot identify the first array element.:

I have passed an array in url which looks like this

http://www.example.com/form.php?action=buy_now&ft=prf&Arrayproducts_id%5B%5D=431&products_id%5B%5D=432&Arraycart%5B%5D=1&cart%5B%5D=3&Arrayid%5B%5D=431&id%5B%5D=432

but when i print the array “products_id” and “cart” by using print_r($_GET), it just display me

Array
(
    [0] => 432
)
Array
(
    [0] => 3
)

now as u can see the url it also contains the value “431” for products_id and “3” for cart
I can see that due to the string “Array” appended to these they are not being accessed, So could someone suggest me how to fix this issue

EDIT as per Felix review

for($t=0;$t<4;$t++){

    $proid_30 .= "products_id[".$t."]=".$products_id."&";
        $bucket_30 .= "cart[".$t."]=".$_SESSION['qty_flex'][$t]."&";
        $idproid_30 .= "id[".$t."]=".$products_id."&";

        }
        $idproid_30.=" ";
$idproid_30 = str_replace("& ","",$idproid_30);
        echo "<script>window.location= '/print_ready_form.php?action=buy_now&ft=prf&".$proid_30.$bucket_30.$idproid_30."&osCsid=".$_GET['osCsid']."';</script>";
  • 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-15T10:47:05+00:00Added an answer on May 15, 2026 at 10:47 am

    Looks like you echo an array to create your URL. This does not work:

    $a = array(1,2);
    echo $a;
    

    prints

    Array
    

    Can you show the PHP code that generates the URL?

    Update:

    Without more code I can only assume, but I think that $proid_30, $bucket_30 and $idproid_30 are initialized as arrays. Now when you append a string, they are casted to strings:

    $a = array(1,2);
    $a .= 'test';
    echo $a;
    

    prints

    Arraytest
    

    Use new variables to build the URL or initialize them as strings:

    E.g.:

    $product = '';
    $cart = '';
    $id = '';
    for($t=0;$t<4;$t++){
        $product .= "products_id[".$t."]=".$products_id."&";
        $cart .= "cart[".$t."]=".$_SESSION['qty_flex'][$t]."&";
        $id .= "id[".$t."]=".$products_id."&";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error message pageContext cannot be resolved but I have no variable
I have some code like this: final int height = 0; //I want to
I have a problem where I cannot identify visitors to my intranet page because
I'm having problems getting a variable ${Error[*]} , which is a regular indexed array,
I've read about non-static variable this cannot be referenced from a static context error
I cannot get/set a static variable inside a method. How can I do it?
I'm using a GET variable and people get to it by the following URL:
I am facing problem to get variable from query string. I have used htaccess
I have a multiple language website, and I use a php get variable to
I've got a NativeActivity which contains an Activity body. The purpose of this activity

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.