how to pass data from view to model in codeigniter

I'm developing a system with codeigniter, in my situation i have to press a link in one user interface and get it's ID and pass it to the model and get the data relevant to that ID and go to the other interface and display the data in the relevant fields, i know how to pass data from model to view, but i don't know how to pass to model from the view, can you guys please help me?

(this is my first CI project)

regards, Rangana

-------------Problems Reply------------

You can pass information between pages in several different ways... here's an example:

Your link:

$uri = $this->uri->uri_to_assoc();

The above code will pass the id in the URL to the model method handleInput. Let's say your URL looks like this: - assuming the ID segment in the URL is always in the same place, that is, after the controller and the method, you can retrieve it like this:

$id = $this->uri->segment(3);

You can also pass data using the post method. You can retrieve safe post values using the post function, like this:

$id = $this->input->post('id');

Category:codeigniter Views:0 Time:2010-08-14

Related post

  • MVC confusion passing data from view to model via controller 2010-11-30

    If a view is served from a controller is it ok to pass data generated in that view via post and pass it straight to a model or do I need go back through the controller that served the view and call the model from the controller? --------------Solutio

  • codeigniter pass data from view to model and retirve info 2010-12-22

    Hier is the thing: I have controller that retrive data from database and pass info to view. In the view I have a loop like this: foreach ($myphotos->result() as $myphoto){ echo $myphoto->p_id } But in that loop I need to pick up $myphoto->p_

  • ASP.NET MVC Passing Data from View to Controller 2009-06-18

    I have a view with a grid that contains items added to a workstation. The user can select an item from a drop down list and click an action link which calls a controller that adds that item to the workstation. I can make it work by reading the FormCo

  • Passing Data between View Controllers 2011-03-06

    I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following: I have a view that acts as a data entry form and I want to give the user the option to select multiple products. The products are listed on another view with

  • ASP .NET MVC How to pass data between views 2011-05-10

    I have this scenarion. There are Boards. And Threads. Therads can be created only on boards, and for that they need to be provided with board ID, Name or something like that, to let SQL know where it should add thread. By now I've been using hidden f

  • MVC passing data from view to cotroller 2011-06-14

    I have little problem here with passing data from view to controller. This is a little CRUD site, here's some code to explain my poblem. Model: public class TempModel{ public List<Temp> Temp1 { get; set; } } View: @{ using (Html.BeginForm()) {

  • Passing Data to View Master Pages 2010-04-26

    Hi I am following the tutorial to pass data to view master page using the "good solution" from this link but after doing the changes as instructed, when i run the application. the application run the a

  • Passing Data to View Master Pages base on login user 2011-04-14

    I've a problem with my mvc application, mvc 3 using spark view engine. I want to bind a dropdownlist that attached to application.spark (master page) base on HttpContext.User.Identity. the problem is..where I should place the ViewData that contain th

  • Pass data between views in tabs iOS 2011-06-28

    I am just starting out on iOS(from Android) and I am having trouble figuring out how to pass data between views in tabs. I've included pictures to describe my question in a little more detail; how can I get the map type to change when one of the sele

  • Django Passing data between views 2011-10-14

    I was wondering what is the 'best' way of passing data between views. Is it better to create invisible fields and pass it using POST or should I encode it in my URLS? Or is there a better/easier way of doing this? Sorry if this question is stupid, I'

  • Xcode 4.2 & Storyboard, how to pass data between views? Existing code error 2012-03-12

    I'm trying to learn how to pass data between views. Say set a label in the second view from text entered into a text field on the first view. I basically have tried making a string in the second view and then when switching from the first view to the

  • Making passing data to views (ASP.NET MVC) easier 2010-07-04

    Very often I need to pass "complicated" data to my views: different database objects, classes etc. And I'm tired of creating dozens of classes-helpers like. class StatsPageViewData { public User User { get; set; } public Something Something { get; se

  • passing data from view to controler and back 2011-03-23

    I am working on an MVC application and I have an index view where I pass model from controller to index view. The index action has no parameters. Now On view I have a jquery calendar. I want to change all the data on view when a date is selected. do

  • mvc3 Problem passing data from View to Controller 2011-09-22

    I am using mvcContrib to generate a grid to allow users to filter data by keying in search data. There are several partial views that are rendered in my Index View: Here is the partial view that handles the searching: @model CRMNPS.Models.PagedViewMo

  • ASP.NET MVC: Passing data from View to Controller (Ajax vs jQuery) 2012-04-28

    This question has been asked before, but none that I have reviewed give a clear or complete solution. I hope you can help me here. I want to pass data entered from the client (an input text field) to the server using AjaxHelper. If there's a more ele

  • How to pass data from viewbag to model in CSHTML 2011-03-08

    I'm having a hard time passing data to my model using viewbag. Here is some example to enlighten you: @model UCPBEscheatment.Models.aspnet_Membership @{ ViewBag.Title = "AnswerForgotPassword"; } <script src="@Url.Content("~/Scripts/jquery.validate

  • Passing data over views 2011-06-23

    I have a navigation based view and the data entered in a view that is lower down in the hierarchy is then to be shown in a table-view in the root-view. How do I pass data entered in a subview to a superview?? --------------Solutions------------- Ther

  • passing data between views on the iPhone using singletons 2011-08-20

    I am trying to use the code found here enter link description here to pass data between two views. It is not working. The only value that is available globally to me is the someProperty value that was set when the object was instantiated. If I update

  • Display part of the data from view's model at a time (ASP.NET MVC 3) 2011-12-15

    I am completely new to ASP.NET MVC, so the question might sound silly. I have a view that should display a part of the data from it's model at a time. And there are buttons that should trigger which part of the data gets shown. So far, I have encapsu

Copyright (C), All Rights Reserved.

processed in 0.062 (s). 11 q(s)