Pass two-dimensional array to PHP by [closed] form

0

Hi, I have a task in php and my teacher has the philosophy that we are looking for a life, I have this code, but I do not know how to pass it to php so he can pick it up and save it in a > two-dimensional array: I would really appreciate the help                           

    <input type="checkbox" name="como[0][0]" id="como1" value="Web">
    <label for="como1">Una web</label>

    <input type="checkbox" name="como[0][1]" id="como2" value="Google">
    <label for="como2">Google</label>

    <input type="checkbox" name="como[1][0]" id="como3" value="Anuncio en prensa">
    <label for="como3">Anuncio en prensa</label>

    <input type="checkbox" name="como[1][1]" id="como4" value="Anuncio en tv">
    <label for="como4">Anuncio en tv</label>

    <button type="submit">Enviar</button>

    </form>
    </body>
    </html>
    
asked by Richard Hanks 29.01.2017 в 19:03
source

1 answer

1

I have tried and it is working correctly for me, php returns that I am sending this (using var_dump ($ _ POST))

array(1) {
  ["como"]=>
  array(2) {
    [0]=>
    array(1) {
      [1]=>
      string(6) "Google"
    }
    [1]=>
    array(1) {
      [1]=>
      string(13) "Anuncio en tv"
    }
  }
} 

If what you are referring to is that you do not know how to use the post method and the action to send it to a certain file in the tag, you should do something like that

<form action="file_that_read_the_array.php" method="POST">
    
answered by 29.01.2017 / 20:31
source