How do I insert multiple checkbox values into a table?

前端 未结 4 1956
太阳男子
太阳男子 2020-11-29 04:01

I cant seem to find or figure out a working solution to insert multiple checkbox values from a form into a table. The closes I have come is inserting the value of merely one

4条回答
  •  遥遥无期
    2020-11-29 04:12

    You need to declare the array in the HTML via

    
    

    Also you can insert multiple items with one query like this

    $query = "INSERT INTO example (orange) VALUES ";
    for ($i=0; $i

    Also keep in mind that mysql_* functions are officially deprecated and hence should not be used in new code. You can use PDO or MySQLi instead. See this answer on SO for more information.

提交回复
热议问题