问题描述:

I'm trying to post an array of variables taken using form data as in checkboxes like this:

<input type="checkbox name="parameter[]" value="XML"/>

<input type="checkbox name="parameter[]" value="test"/>

<input type="checkbox name="parameter[]" value="action"/>

When this data is submitted, I can see in the Google chrome console, the variables are each posted as parameter[]. I can enumerate over the posted values using a

foreach ($_REQUEST['parameter'] as $param) construct.

Due to the way my program is set up, how do I go about writing a query string in which I can send the data through GET request. For example writing:

taskpage.php?parameter[]=xml&parameter[]=test&parameter[]=action

doesn't seem to post the parameter data as an array.

Any advice on how to write this string?

网友答案:

Notice parameter[] != parameter .

It works if you remove the [].

taskpage.php?parameter=xml&parameter=test&parameter=action

Then take a look to $_GET['parameter']

var_dump($_GET['parameter'])
相关阅读:
Top