php variable in html |
[eluser]Bluemagix[/eluser]
Hello, I want to use one form(View)variable in to another form(view) using the controller. i have called the view page like this http://localhost/category/upload/9/ where upload is my function in cotroller from where i am calling the view page and 9 is the argument passed to that function. now if i want the value 9 in my view page how can i get that in code igniter
[eluser]The Wizard[/eluser]
say you have the variable $foo = '3'; in your controller, you have to put it into the $data array like: Code: $data['foo'] = '3'; then in your html you do: Code: hello this is a HTML file. <br /> take care.
[eluser]Bramme[/eluser]
Code: $my_array = array("foo" => "bar", "some" => "shizzle"); Easy as pie! At first I didn't like this approach, but after working a while with CodeIgniter, this really works well. It's really handy when debugging for instance: just print_r the $data array and you see what variables you have in your view...
[eluser]Bluemagix[/eluser]
but how can i access that in view?? suppose i want value of foo of data array in view
[eluser]Bramme[/eluser]
http://ellislab.com/codeigniter/user-gui...views.html |
Welcome Guest, Not a member yet? Register Sign In |