Send select's values in array

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

I have such select list in html:

123
4条回答
  •  不思量自难忘°
    2021-01-26 13:41

    As others have mentioned, you should name your inputs according to the typical 'array' naming convention. PHP will automatically turn array syntax in your request variables into an array. Thus, you should name your checkboxes in the form drive_style[name]. To submit this information in JQuery we simply serialize the form: $('form_id').serialize() ought to do the trick. As follows:

    
    
        
            
            Test
            
            
        
        
            
    One
    Two
    Three

    And to read this information on the PHP side is also very simple:

    // http://localhost/test.php
    

    Notably this naming convention also allows you to submit the form regularly.

提交回复
热议问题