Send select's values in array

后端 未结 4 901
旧巷少年郎
旧巷少年郎 2021-01-26 13:10

I have such select list in html:

123
4条回答
  •  太阳男子
    2021-01-26 13:51

    ​$(function() {
    var serial = $('input[name=drive_style]').serialize();
    //php -> $('input[name=drive_style[]]').serialize();
      alert( serial );
    });​
    

    this give you:

    drive_style=1&drive_style=3&drive_style=5
    

    but for work with php you also need to have input name like this:

    123

    NOTE: drive_style[]

    that obviously giv you:

    drive_style[]=1&drive_style[]=3&drive_style[]=5
    

提交回复
热议问题