I'm new programmer and learning how to get data from database using Codeigniter and Java. Currently doing a system for user to post comment on different post. Below each post will have "post comment" button. For example, there were several post on a page. When a user click on button "Post a Comment" on A post, it will link to another page posting the comment, but how to make the page know that it post comment on A post. After post the comment, the database will show like user post the comment at A post. Any website for me to refer or study about it? thank you...
-
1You should add some code, otherwise a lot of user will vote down your question.Deniz B.– Deniz B.2016-04-27 08:24:30 +00:00Commented Apr 27, 2016 at 8:24
-
Agreed with Deniz put some code or else you will have a many down votes, also adding code will help us know how to help youRajan– Rajan2016-04-27 10:17:46 +00:00Commented Apr 27, 2016 at 10:17
Add a comment
|
1 Answer
Let's say you have a post with id (primary key, generated by the database) 37. Then, the button or link just below the post should have a link to something like:
'index.php/comment/newcomment/37'.
Here, comment is your controller to be used for handling the comments and newcomment is the function in the comment controller. In newcomment function, you can take the post id (37 in our example) as the parameter of the function.
You can refer to CodeIgniter: adding parameters to URL for more information.