How to pass ID through a form? |
[eluser]Volkof[/eluser]
Hi guys, In my view, I have a review(basically a paragraph of text) and a comment box at the bottom. Since the review is fetched from database, I have the reviewID. So now what Im trying to do is when a user enters comments into the box and click submit, the reviewID and comments will be passed to the controller to store into the database. Problem is I'm not sure how to pass the reviewID through <form> Code: echo form_open('comment/addComment/'); I tried Code: echo form_open('comment/addComment/'$row->reviewID); Any idea? Thanks in advance
[eluser]maesk[/eluser]
Hi, I would use a hidden form field for this. Before your "form_close();" add: Code: echo form_hidden('reviewID', $row->reviewID); Then, in your controller, you can access the value with Code: $this->input->post('reviewID'); Check out the form helper for more information about creating hidden fields: http://ellislab.com/codeigniter/user-gui...elper.html
|
Welcome Guest, Not a member yet? Register Sign In |