Welcome Guest, Not a member yet? Register   Sign In
Got "Disallowed Key Characters." when submit form include dropdownbox
#1

[eluser]Kency[/eluser]
Hello everyone im new in codeigniter, i got a problem

Quote:Disallowed Key Characters.

When i try to submit a form include dropdownbox has contain data from Database (because i use Vietnamese therefore i think it is problem but i have no idea for solve it )

My dropdownn box contain id is key and category name is value

my array dropdown box like Array ( [1] => Áo [2] => Quần [3] => Váy )

but when i submit form i got
Quote:Disallowed Key Characters

i dont know how to solve it

my form code

Code:
<!-- Title area -->
<div class="titleArea">
    <div class="wrapper">
        <div class="pageTitle">
            <h5>Quản lý sản phẩm</h5>
        </div>
        <div class="clear"></div>
    </div>
</div>
&lt;!-- Main content wrapper --&gt;
<div class="wrapper">



    &lt;!-- Validation form --&gt;
    &lt;?php
    $attributes = array("class" => "form", "" => "validate", "method" => "POST");
    echo form_open_multipart("admin/product/addproduct",$attributes);?&gt;
    &lt;?php echo form_fieldset() ?&gt;
    <div class="widget">


        <div class="title"><h6>
            &lt;?php
            $id = $this->uri->segment(4);
            if($id != null){

                echo "Thay đổi thông tin sản phẩm";
            }else{
                echo "Thêm sản phẩm mới";
            }
            ?&gt;

        </h6></div>

        <div class="formRow">

            &lt;!-- choose category --&gt;

            <label>Danh mục sản phẩm:<span class="req">*</span></label>
            <div class="formRight">
                <div class="floatL">
                    &lt;?php
                    $dropdownvalue= array();// create array to store data load from controller
                    foreach($getAllCategory as $row){  // user loop to check to each row
                        $dropdownvalue[$row->idcategory] = $row->categoryName;   //key is id and name is category name

                    }
                    print_r($dropdownvalue);
                    echo form_dropdown("Danh mục", $dropdownvalue);
                    ?&gt;
                </div>
            </div><div class="clear"></div>
        </div>

        &lt;!-- product name --&gt;


        <div class="formRow">
            <label>Tên sản phẩm:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php
                $data = array(
                    "name" => "productname",
                    "value" => ""
                );
                echo form_input($data);
                ?&gt;
            </div><div class="clear"></div>
        </div>

        &lt;!-- product image upload --&gt;

        <div class="formRow">
            <label>Hình sản phẩm:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php echo form_upload("userfile") ?&gt;
            </div><div class="clear"></div>
        </div


            &lt;!-- product price --&gt;

        <div class="formRow">
            <label>Giá:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php
                $data = array(
                    "name" => "productprice",
                    "value" => ""
                );
                echo form_input($data);
                ?&gt;
            </div><div class="clear"></div>
        </div>

        &lt;!-- product size --&gt;

        <div class="formRow">
            <label>Size:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php
                $data = array(
                    "name" => "productprice",
                    "value" => ""
                );
                echo form_input($data);
                ?&gt;
            </div><div class="clear"></div>
        </div>

        <div class="formRow">
            <label>Màu sắc:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php
                $data = array(
                    "name" => "productprice",
                    "value" => ""
                );
                echo form_input($data);
                ?&gt;
            </div><div class="clear"></div>
        </div>

        &lt;!-- Thông tin sản phẩm hình ảnh thông tin --&gt;

        <div class="formRow">
            <label>Thông tin:<span class="req">*</span></label>
            <div class="formRight">
                &lt;?php echo form_textarea("producttextarea", "", "class='ckeditor'"); ?&gt;
            </div>
            <div class="clear"></div>
        </div>

        &lt;!-- submit button --&gt;

        <div class="formSubmit">&lt;?php echo form_submit("addproduct", "Lưu", "class='redB'");?&gt;</div>
        <div class="clear"></div>

    </div>

    &lt;?php echo form_fieldset_close(); ?&gt;
    &lt;!--&lt;/form&gt;--&gt;
    &lt;?php echo form_close();?&gt;

</div>
<div class="clear"></div>
#2

[eluser]ojcarga[/eluser]
Try change "Danh mục" for other word, like "Danh_muc" in:

Code:
echo form_dropdown("Danh mục", $dropdownvalue);

for testing.

Or you can try what @CroNiX said on thread http://ellislab.com/forums/viewthread/211588/

Also see this one http://ellislab.com/forums/viewthread/202594/

You should look for older posts before ask ;-)
#3

[eluser]Kency[/eluser]
[quote author="ojcarga" date="1336284572"]Try change "Danh mục" for other word, like "Danh_muc" in:

Code:
echo form_dropdown("Danh mục", $dropdownvalue);

for testing.

Or you can try what @CroNiX said on thread http://ellislab.com/forums/viewthread/211588/

Also see this one http://ellislab.com/forums/viewthread/202594/

You should look for older posts before ask ;-)
[/quote]

Oh Thank you very much, it work well

my mistake Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB