Problem processing an array of textareas when they are loaded dynamically with jQuery and PHP
<p>I am experiencing problems trying to do a multitextarea on a form.</p>

<p>I've a PHP view that has various forms, all processed different but in the same file. They all works, I've tested and they works. In forms there are a + icon that let the user add more instances of a <code>&lt;textarea /&gt;</code>. This + icon loads via AJAX a new textarea with the same name of the previous textarea (for example, name="example[]"). If I post this, it only gets the first item that is the one that wasn't previously loaded by jQuery. The problem is that the ones loaded dynamically are totally ignored and I don't know why.</p>

<p>My extract of my PHP view:</p>

<pre><code>    &lt;?php echo form_open("projects/view/".$projectid); ?&gt; &lt;!-- This generates a valid &lt;form /&gt; tag --&gt;
        &lt;table&gt;
            &lt;tr&gt;
                &lt;th&gt;&lt;?php echo lang("label_conx");?&gt;&lt;/th&gt;
                &lt;td class="textarea-edit"&gt;
                    &lt;textarea class="context" name="CONX[]"&gt;&lt;?php echo set_value("CONX[]");?&gt;&lt;/textarea&gt;
                &lt;/td&gt;
                &lt;td class="add"&gt;&lt;a id="add-conx" href="#"&gt;&lt;?php echo img("img/icons/plus.png");?&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
...
</code></pre>

<p>My jQuery code that works fine because the content is displayed and I see in firebug that is the same as the html loaded textarea:</p>

<pre><code>$("a#add-conx").click(function(){
    $("#ajax-loader").fadeIn('normal');

    $("textarea.context:last").after('&lt;textarea class="context" name="CONX[]"&gt;&lt;/textarea&gt;');

    $("#ajax-loader").fadeOut("normal");

    return false;
});
</code></pre>

<p>And when I send the form, I've a in my PHP controller <code>print_r($_POST);</code> and I only get:</p>

<pre><code>Array
(
    [CONX] =&gt; Array
        (
            [0] =&gt; safdsddasfafsd
        )
    ...
</code></pre>

<p>If I put on the PHP view various textareas, this array increases as same of the number of textareas I've created on the HTML view file. I don't understand why this is not working.</p>

<p>When the page is load:
<img src="http://i.stack.imgur.com/d7j5y.png" alt="enter image description here"></p>

<p>After adding some content dynamically:
<img src="http://i.stack.imgur.com/DtQuF.png" alt="enter image description here"></p>

<p>This two images shows 4 instances of textarea with the name context[] 
(that has been changed to CONX[], but fails equal) that are in the view. The second image shows the loaded ones with jQuery and PHP only detected the first 4 that were on the HTML.</p>

<p>Anyone has some idea how I can solve this?</p>

<p>Thank you in advance!</p>
