Welcome Guest, Not a member yet? Register   Sign In
problem catching form value
#1

[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.
#2

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




Theme © iAndrew 2016 - Forum software by © MyBB