how to get data from html table and put it in php text fields?
<p>This is my table created:</p>

<pre><code>    &lt;table class="table table-striped table-bordered" id="example"&gt;
    &lt;thead&gt;
    &lt;?php
        foreach ($fields as $field_name =&gt; $field_display){
             echo "&lt;th&gt;".$field_display."&lt;/th&gt;";
        }
    ?&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;?php
        foreach ($users as $row){
        echo "&lt;tr&gt;";
        foreach($fields as $field_name =&gt; $field_display){
            if($field_name == 'username'){
            echo "&lt;td&gt;&lt;a href='#' onclick=\"edituserdata('".$row-&gt;username."')\"&gt;".$row-&gt;$field_name."&lt;/a&gt;&lt;/td&gt;";
        }else{
            echo "&lt;td&gt;".$row-&gt;$field_name."&lt;/td&gt;";
        }
        }
        echo "&lt;/tr&gt;";
        }
    ?&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
</code></pre>

<p>And this is the bootstrap modal that appears when I click on a row:</p>

<pre><code>    &lt;!-- Modal --&gt;
&lt;div id="myModal1" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
&lt;div class="modal-header"&gt;
&lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
&lt;h3 id="myModalLabel"&gt;Update you're data&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
        &lt;?php echo form_open('main/update'); ?&gt;

        &lt;?php 

        $name = array(
                'name' =&gt; 'name',
                'id' =&gt; 'name',
                'value' =&gt; set_value('name')
        );
        ?&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Name:&lt;/label&gt;
            &lt;div&gt;
                &lt;input type="text" name="name" placeholder="Name" id="name" value=""&gt;
                &lt;?php echo form_error('name', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Username:&lt;/label&gt;
            &lt;div&gt;
                &lt;input type="text" name="username" placeholder="Username" id="username" value=""&gt;
                &lt;?php echo form_error('username', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Password: &lt;/label&gt;
            &lt;div&gt;
                &lt;input type="password" name="password" placeholder="Password" id="password" value=""&gt;
                &lt;?php echo form_error('password', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Retype password: &lt;/label&gt;
            &lt;div&gt;
                &lt;input type="password" name="password1" placeholder="Retype password" id="password1" value=""&gt;
                &lt;?php echo form_error('password1', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Email address: &lt;/label&gt;
            &lt;div&gt;
                &lt;input type="email" name="email" placeholder="Email" id="email" value=""&gt;
                &lt;?php echo form_error('email', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Phone number: &lt;/label&gt;
            &lt;div&gt;
                &lt;input type="tel" name="tel" placeholder="Phone number" id="phone_number" value=""&gt;
                &lt;?php echo form_error('tel', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="control-group"&gt;
            &lt;label class = "control-label" for="name"&gt;Description: &lt;/label&gt;
            &lt;div&gt;
                &lt;input type="text" placeholder="Description" name="descr" id="description" value=""&gt;
                &lt;?php echo form_error('descr', '&lt;span class="alert-error help-inline"&gt;', '&lt;/span&gt;')?&gt;
            &lt;/div&gt;
        &lt;/div&gt;


&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;div class="container-fluid"&gt;
    &lt;div class="row-fluid"&gt;
        &lt;div class="span5" id="message_add_user_id"&gt;
        &lt;/div&gt;

        &lt;div class="span7"&gt;
            &lt;button id="add_user_submit" type="button" class="btn btn-success"&gt;Update &lt;i class="icon-white icon-check"&gt;&lt;/i&gt; &lt;/button&gt;
            &lt;button class="btn" onClick="document.location.reload(true)" data-dismiss="modal" &gt;Close&lt;/button&gt;
        &lt;/div&gt;          
    &lt;/div&gt;
&lt;/div&gt;
&lt;?php echo form_close();?&gt;
</code></pre>

<p>and here is the function with which the modal will appear:</p>

<pre><code>    function edituserdata(username){
      $('#myModal1').modal('show');
    }
</code></pre>

<p>and when I click on a row, I want to have that user's data int the bootstrap modal's text fields. How can I do that?</p>
