ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to post textbox values having dynamic id.

December 08, 2013 2:52pm

Subscribe [1]
  • #1 / Dec 08, 2013 2:52pm

    Sandip Ray

    7 posts

    <?php
            $data1=$this->am->FetchChildCategory($val[‘category_id’]);
                                    foreach($data1 AS $val1)
                                    {
    ?>
    <div >
    <input type="text" id="ccname<?php echo $val1['category_id'];?>" name="ccname<?php echo $val1['category_id'];?>" value="<?php echo $val1['name'];?>"/>
    </div>
    <div 50px;">
    <a id="<?php echo $val1['category_id'];?>" name="<?php echo $val1['category_id'];?>"><font color="blue">Update</font></a>

    </div>
    <?php
    }
                                  ?>
    From the above code you see that the <input type=“textbox “/> has dynamic id as id=“ccname<?php echo $val1[‘category_id’];?>”.

    Now my question is how will I post the value of the textbox in Controller function say UpdateCategory()? Or in other words how shall I get the textbox value in the controller function UpdateCategory()?

    In the Controller I wrote as follows:

    class Controller extends CI_Controller
    {
    public function UpdateCategory()
    {
    $txt=$this->input->post('ccname<?php echo $val1["category_id"];?>');
    echo $txt;
    }
    }

    Blank page is coming up. Please help. New to codeigniter.
    Thank u all.
    Sandip Prasad Ray

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases