I'm trying to recreate a "commentary section" on my project. I have a loop to display many "posts" and each post has it's own comment section, all inside the same Form. because of that I end up having multiple fields with similar names (i.e button1, button2, button3, etc etc etc, one for each post). Is it possible to have one isset($post['button']) that fits all and only brings the info related to the one I clicked?
I could have each post be a separate Form but then I would have do re-do a good portion of what I did so far. I was hoping there's a way around it
that's what I have:
input type='text' name='post_comment".$k."' class='form-control' value=''
input type='submit' class='btn' name='postComment".$k."' value='Comment'
...
if(isset($post['postComment'])){
//do something
}
If I hardcode $k into my isset (i.e isset($post['postComment34'])) everything works as I wanted. Is it possible to have my isset accept any 'postCommentxx'?