A $_GET input paramter that's an Array

Posted by donpal on Stack Overflow See other posts from Stack Overflow or by donpal
Published on 2010-05-25T23:03:53Z Indexed on 2010/05/25 23:11 UTC
Read the original article Hit count: 182

Filed under:
|
|

I'm trying to pass 3 parameter to a script, where the 3rd parameter $_GET['value3'] is supposed to be an array

$_GET['value1'] 
$_GET['value2'] 
$_GET['value3'] //an array of items

I'm calling the script like this: (notice my syntax for value3, I'm not sure it's correct)

http://localhost/test.php?value1=test1&value2=test2&value3=[the, array, values]

I then use a foreach to hopefully loop through the third parameter value3 which is the array

//process the first input $_GET['value1']

//process the second input $_GET['value2']

//process the third input $_GET['value3'] which is the array
foreach($_GET['value3'] as $arrayitem){
    echo $arrayitem; 
}

but I get the error Invalid argument supplied for foreach()

I'm not sure if my methodology is correct. Can some clarify how you'd go about doing the sort of thing

© Stack Overflow or respective owner

Related posts about php

Related posts about array