parameter passing from view to controller via anchor |
[eluser]Lakshminarayanank[/eluser]
Hi all... I am a fresher to CI.. using with mysql I am facing a difficulty in passing and accessing the parameter. here is ma code.. in a view : $d = array('proj_id'=>$pid) echo anchor('aims/view_project',$pid,$d) in controller am accessing it.. function view_project() { echo 'project no is' .$proj_id; } Am getting undefined symbol proj_id error message .. i got helg up there... pls help me...!!
[eluser]danmontgomery[/eluser]
Code: echo anchor('aims/view_project/'.$pid, 'Link'); http://ellislab.com/codeigniter/user-gui.../urls.html
[eluser]Lakshminarayanank[/eluser]
No.. :-( I am getting a warning as missing argument and an error for using indefined variable ($pid)...
[eluser]Bart v B[/eluser]
Take a look at your url.. Code: $this->load->helper('url');
[eluser]OliverHR[/eluser]
In the view as noctrum say: Code: echo anchor('your_controller/your_function/'.$pid, 'Link text'); On the controller: Code: function your_function($proj_id) // check your parameters names
[eluser]Lakshminarayanank[/eluser]
thank you guys... thats superb.... and i wanna pass an argument from controller to a model... how can i do that...?! plz help me...!!
[eluser]OliverHR[/eluser]
??? No offense man but, It could be better if you read first the documentation and a good php book.
[eluser]Lakshminarayanank[/eluser]
hmmm ya.... could you pls suggest me some good books for php.... so that i can work well with codeigniter.... plz help.. as i said.. am new to this area....
[eluser]OliverHR[/eluser]
Well look at this titles. Beginning PHP5 Wrox Press PHP 5 Power Programming PRENTICE HALL Object-Oriented Programming with PHP5 Packt Publishing PHP Objects, Patterns, and Practice Apress Pro PHP Patterns, Frameworks, Testing and More Apress ---------- And of course the CI docs: http://ellislab.com/codeigniter/user-guide/ |
Welcome Guest, Not a member yet? Register Sign In |