CodeIgniter Forums
anchor; get method; ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: anchor; get method; ? (/showthread.php?tid=51820)



anchor; get method; ? - El Forum - 05-19-2012

[eluser]PankajBalani[/eluser]
I have the following in my view:

<?php echo anchor('lb/test', $row->name, array('rowName'=>$row->Name)); ?>

and in the lb controller

public function test(){
$namearray['name'] = $this->input->get('rowName');
$this->load->view('newView',$namearray);
}

On 'newview' I have:
<html><body>You clicked on <?php echo $name; ?> </body></html>

doesn't work Sad ????


anchor; get method; ? - El Forum - 05-19-2012

[eluser]Samus[/eluser]
i'm going to assume you're not actually sending anything through the GET array.

Post what your url looks like.


anchor; get method; ? - El Forum - 05-19-2012

[eluser]PankajBalani[/eluser]
[quote author="Samus" date="1337418133"]i'm going to assume you're not actually sending anything through the GET array.

Post what your url looks like.[/quote]

yeah i just realized that i am not sending any info to get.
So my question should be how to send some info to controller when user clicks a link.

url looks like "www...../lb/test"


anchor; get method; ? - El Forum - 05-19-2012

[eluser]Samus[/eluser]
[quote author="PankajBalani" date="1337418772"]
So my question should be how to send some info to controller when user clicks a link.

url looks like "www...../lb/test" [/quote]

Have your controller accept a parameter.

If you have a controller like this:

Code:
Controller extends CI_Controller {

function test($param)
echo $param;
}

Then your url looks like this:

www.site.com/controller/test/samus

if I entered that url, the controller will echo 'samus'.


anchor; get method; ? - El Forum - 05-19-2012

[eluser]PankajBalani[/eluser]
how does my anchor link look like in this case??


<?php echo anchor(‘lb/test’, $row->name, array(‘rowName’=>$row->Name)); ?>


sorry for asking basic questions!


anchor; get method; ? - El Forum - 05-19-2012

[eluser]PankajBalani[/eluser]
ok sorry that was really dumb of me...you had already answered that.

thanks it has been great help! Smile