Welcome Guest, Not a member yet? Register   Sign In
passing data from view to controller
#1

[eluser]jupiter1031[/eluser]
I am new to CI and have a basic question:
I have an overview page that successfully displays all projects of a company. This is an overview page. Every item has a link to a detail view. As I understand I write another controller method that will go to the database - get the detail data and display them in a view method.
Concretely in this view is a picture, when I click on it I should get a new screen of a detail view of that item. In this case more pictures and more information.

My problem is how to pass the index/key of that item to the controller method to display a specific view?
It seems pretty basic but I did not find specific information in the documentations.

Please provide a simple example. So I don't have to ask back. Or guide me to a specific area in the documentation to get more information on this topic.
#2

[eluser]WanWizard[/eluser]
Use a URI segment:
Code:
/controller -> calls the index the index method
/controller/detail/1 -> calls the detail method, and passing value 1 as parameter
#3

[eluser]jupiter1031[/eluser]
I hope I got this:


<div id="image"> <a >prj_index);?&gt;?&gt;"> &lt;?php echo img($image_properties); ?&gt; </a> </div>

on the receiving end how tdo I accept the key?

right now the controller method looks like this:


function put_project_detail()
{
$this->load->model('projects_model');
$data['records'] = $this->projects_model->getOneProject();
$this->load->view('eng-project-detail',$data);}
}

I need to pass the key to procects_model->getOneProject()

Thank you for your help!!
#4

[eluser]WanWizard[/eluser]
Take some time to read the user guide carefully, it is very good, and explains most questions beginners have.

In this case: http://ellislab.com/codeigniter/user-gui...passinguri




Theme © iAndrew 2016 - Forum software by © MyBB