Level 4
@bestmomo You have helped me out great last time. Do you have an idea how i can solve this? :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Im trying to store data in this table:
newspaper_id
article_id
comment (string)
This is how my HTML looks like:
<div class="newspaper-options">
<input class="form-control" name="data[]" type="text">
<input type="checkbox" class="article-option" name="article_id[]" value="3"> Active
</div>
<div class="newspaper-options">
<input class="form-control" name="data[]" type="text">
<input type="checkbox" class="article-option" name="article_id[]" value="1"> Active
</div>
This is the result im getting back when i only fill in the second newspaper options and check it:
"comment" => array:2 [▼
0 => ""
1 => "option 2"
]
"article_id" => array:1 [▼
0 => "1"
]
The problem im having is how can i group the input values so i can store it inside my table. The value of my checkbox is that of the article_id. and the text field is used to fill the comment inside the database.
Any help with this would be greatly appreciated!
Please or to participate in this conversation.