CodeIgniter Forums
NewBie...Hwo to pass query string parameter from list view - 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: NewBie...Hwo to pass query string parameter from list view (/showthread.php?tid=30152)



NewBie...Hwo to pass query string parameter from list view - El Forum - 05-04-2010

[eluser]myjeep_2003[/eluser]
I am trying to pass querystring parameter from listview to detail view... like this ... some wrong in my procedure...

My view look slike this where it creates a link with $id

<p>
&lt;?php foreach($query_show_plan_and_prepare_list as $row):?&gt;

&lt;?php form_hidden('myid',$row->id);?&gt;
<p><h3>&lt;?php echo anchor('mycontent/show_plan_detail/'.$row->id, $row->Title);?&gt;</h3></p>
<p class="info">posted: &lt;?php echo $row->modified;?&gt;</p>
&lt;?php endforeach;?&gt; </p>


On clicking

<p><h3>&lt;?php echo anchor('mypost/show_plan_detail/'.$row->id, $row->Title);?&gt;</h3></p>


I want to pass the parameter(id) to my controller mypost/show_plan_detail function.

Then I want to use the passed parameter(id) to write a query in Model.. what will show content Detail of that id..


NewBie...Hwo to pass query string parameter from list view - El Forum - 05-04-2010

[eluser]Ngulo[/eluser]
hi,you should use uri helper , to extract $this->uri segment();

for example

mysite.com/action/9

$this->uri->segment(3) returns 9


NewBie...Hwo to pass query string parameter from list view - El Forum - 05-05-2010

[eluser]myjeep_2003[/eluser]
Hey thanks a million... that was sweet....victory..worked....


NewBie...Hwo to pass query string parameter from list view - El Forum - 05-05-2010

[eluser]Ngulo[/eluser]
eheheh don't worry this is the basics,i also had to learn them Wink