getting a checkbox array value from POST

后端 未结 5 1765
一整个雨季
一整个雨季 2020-11-28 13:10

i am posting an array of checkboxes. and i cant get it to work. i didnt include the proper syntax in the foreach loop to keep it simple. but it is working. i tested in by tr

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 13:35

    Check out the implode() function as an alternative. This will convert the array into a list. The first param is how you want the items separated. Here I have used a comma with a space after it.

    $invite = implode(', ', $_POST['invite']);
    echo $invite;
    

提交回复
热议问题