How to (correcly) pass variables from a loop (in view) to a Controller |
[eluser]Juan Velandia[/eluser]
Hello everyone, im trying to create a page in wich people could post some comments or questions of a certain record from a data base, (similar to facebook). The issue is that I'm trying to pass the id of a particular database record, but I end up passing the higest (last) id of the loop Here it is: model: Code: function get_tarea() view Code: foreach ($tarea as $row): controller (for the insertion) Code: function question_insert(){ The issue is that post('id_tarea') is always the same: the last record from the database. If anyone wants to see the actual output of this code: http://www.nemoestudio.com/es/support Thanks in advance for your ideas!
[eluser]bluematt[/eluser]
You need an echo on your form_close(). Your browser is treating this as one big form, and where multiple inputs have the same name, the last one POSTed will be used as the value.
[eluser]Juan Velandia[/eluser]
Hello bluematt... thanks a lot! sometimes my background as a ghraphic designer doesn´t help to solve this kind ok issues. best regards! |
Welcome Guest, Not a member yet? Register Sign In |