Paste $ request values

0

I would like to get all the values of a given key from a request.

Ex Request:

  

nnmSoftware = 7-Zip & idSoftware = 1181 & nmLocal = Enterprise & network = 1 & nmSoftware = account-plugin-aim & idSoftware = 1 & nmocal = Enterprise &   referer: link

But when I try to get with $software = $request->get('idSoftware'); it only returns idSoftware = 1 .

How would I get everyone? idSoftware = 1, 1181

    
asked by anonymous 03.02.2015 / 17:02

1 answer

3

In the query, the idSoftware field repeats twice:

  

nnmSoftware = 7-Zip & idSoftware = 1181 & nmLocal = Company & network = 1 & nmSoftware = account-plugin-aim & idSoftware = 1 & nmLocal = Company & network = 1

When doing this, GET recognizes only the last idSoftware with value 1 .

To receive all occurrences of idSoftware you need the method to be sent via POST and have [] in the input name. So idSoftware will be an array.

<form method="POST">
    <input name="idSoftware[]">
    <input name="idSoftware[]">
    <input name="idSoftware[]">
</form>

Result:

array(1) {
  ["idSoftware"]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(118)
  }
}
    
03.02.2015 / 17:49