$_GET variable cannot identify the first array element.:
I have passed an array in url which looks like this
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>";
Looks like you
echoan array to create your URL. This does not work:prints
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_30and$idproid_30are initialized as arrays. Now when you append a string, they are casted to strings:prints
Use new variables to build the URL or initialize them as strings:
E.g.: