• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to pass data from a view to a controller?

#1
[eluser]theciman[/eluser]
I have a view where I have a hidden form which contains the id of a database table. I want to pass that id to my controller using the $this->input-post method but it seems that hidden forms does not allow this. If I put the id in a form_input field it works fine.

Here is the code for the controller:
function update_project()
{
$project_id = $this->input->get('ProjectID');
echo $project_id;
{


and the code for the view:

echo form_open('test/update_project');

$id_name = 'ProjectID';
$hidden_value = array('name' => $id_name, 'id' => $id_name, 'value' => $row->$id_name); //note $row->$id_name contains the table id I need which is there and valid
echo form_hidden($hidden_value); //pass the ID with a hidden form

echo form_submit('project_submit', 'Submit Changes');
echo form_close();

Any help would be appreciated.


Messages In This Thread
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 10:17 AM
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 10:20 AM
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 10:37 AM
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 11:46 AM
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 11:52 AM
How to pass data from a view to a controller? - by El Forum - 02-12-2010, 12:09 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 11:46 AM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 11:59 AM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 12:22 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 12:35 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 12:37 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 01:05 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 01:24 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 01:34 PM
How to pass data from a view to a controller? - by El Forum - 02-15-2010, 01:36 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.