• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing data to a model

#1
[eluser]Martin Hedegaard[/eluser]
Is there someone here who knows how I send data / variable to a "model" from a "view" in codeigniter?

#2
[eluser]siptik[/eluser]
Why do you need it? This violates the concept of MVC

#3
[eluser]Martin Hedegaard[/eluser]
[quote author="siptik" date="1347182459"]Why do you need it? This violates the concept of MVC[/quote]
Okay... How do i then send it to the controller? :-)

#4
[eluser]siptik[/eluser]
it too))

#5
[eluser]sofwan[/eluser]
Although it violates the concept of MVC but you can send data using session.
Save your data to session variable from your view and in Model, retrieve it.

http://ellislab.com/codeigniter/user-gui...sions.html

#6
[eluser]Martin Hedegaard[/eluser]
thank :-)

#7
[eluser]TWP Marketing[/eluser]
You can also use an HTML form to POST data back to your controller.

You may also use parameters in an URL link within your view and read them as URI segments (see the User Guide URI class).

#8
[eluser]siptik[/eluser]
As I understand he meant a little more. he wants to create a variable in the template and send it to the controller or model.
for example:
template:
<div>&lt;? $date = date('d.m.y',time());?&gt;</div>

and he wants to get the $date in the controller

#9
[eluser]TWP Marketing[/eluser]
@martin,
Will you be more specific. What do you want to do and why?
We are trying to guess at your meaning and telepathy is notoriously unreliable...


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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