CodeIgniter Forums
problem catching form value - 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: problem catching form value (/showthread.php?tid=27313)



problem catching form value - El Forum - 02-07-2010

[eluser]KrizzAngel[/eluser]
heres my code form with looping textarea:

Quote:<? echo form_open('admin/addLesson'); ?>
<input type="hidden" name="lessnum" value="<? echo $lessNum; ?>" />
&lt;? for($a=1; $a<=$lessNum; $a++){ ?&gt; <----$lessNum is value that i got from another page.
Lesson Title: &lt;input type="text" name="&lt;? echo 'title'.$a; ?&gt;" /&gt;
&lt;textarea name="&lt;? echo 'content'.$a; ?&gt;"&gt;&lt;/textarea>
&lt;? } ?&gt;
&lt;input type="submit" value="Next" /&gt;
&lt;? echo form_close(); ?&gt;

the problem is that i cant get the value on looped items which is title and content.

here my controller:

Quote:function addLesson() {

$num=$this->input->post('lessnum');
for($s=1;$s<=$num;$s++){
$new="title".$s;
echo "tester".$this->input->post('title$s');
}
}
what i was getting is if the number of loop is two.. ill get testertester.. cant get the post value.


problem catching form value - El Forum - 02-07-2010

[eluser]pistolPete[/eluser]
How about
Code:
$this->input->post('title'.$s);