form submit not working

前端 未结 2 378
陌清茗
陌清茗 2021-01-26 17:55

I have a table that prints out all available cameras. It uses a form to change these settings. The problem is that the form only updates the last camera in the entry. In other

相关标签:
2条回答
  • 2021-01-26 18:34

    It looks like you have multiple HTML elements with the same name. As such, you want to get back an array of values when the form is posted.

    As such, Get $_POST from multiple checkboxes looks like it might be helpful.

    Alternatively, extend oncameraSubmit so that it stores all the data in a hidden input field (not just the id). Then when you update the database, use these hidden fields.

    0 讨论(0)
  • 2021-01-26 18:43

    Your form element names are clashing. When you define a form element e.g. 'camera_status' twice, you will only receive the last value in the POST.

    Use form array notation, e.g.: "camera_status[]" or even better "camera_status[$id]". Then your PHP code will recieve arrays as POST data and you will be able to update everything at once.

    0 讨论(0)
提交回复
热议问题