Welcome Guest, Not a member yet? Register   Sign In
How to pass a data variable into an anchor tag?
#1

[eluser]Unknown[/eluser]
Hi guys,

i have a controller returning some output into a view.

In the view i want to create an anchor or button to save the statistics into a database.

however i want to pass 2 parameters which are both arrays into the anchor tag to call the save function inside the controller, how do i do that?

function result() --> result_view -->save_result(arg1, arg2)
#2

[eluser]dark_lord[/eluser]
I believe the anchor() will solve your problem here.

echo anchor('news/local/123', 'My News', 'title="News title"');

news == controller
local == method
123 == argument1

add another argument
e.g. echo anchor('news/local/123/ABC', 'My News', 'title="News title"');

ABC == argument2

Note: 123 argument can come from database result which basically can make it more dynamic.

Refer to (for more information):

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

Hope that helps!




Theme © iAndrew 2016 - Forum software by © MyBB