Last Form Field Name Is Not Identifying In Controller

hello everyone,

i have many fields in my _form. when i am setting id and name of those fields,it accepting in controller. but when i am setting name of the last field of the form, in the controller create method it’s not going inside if(isset($_POST[‘xyz’])) loop.

But if i won’t set last field name (not id) then it’s going inside if(isset($_POST[‘xyz’])) loop.

i don’t know how to solve it?

is it Bug or some problem with my code? :rolleyes:

Please Suggest me

[/size]

No dear, Its neither bug nor code problem.

When you use different id it show in [color="#1C2837"][size=“2”]$_POST[‘xyz’] parameter because it will print [/size][/color][color="#1C2837"][size=“2”]$_POST[‘xyz’] using element name.[/size][/color]

[color="#1C2837"][size="2"]So, if you use below code it will work fine,[/size][/color]

[size="2"][color="#1c2837"]

[/color][/size] [size="2"][color="#1c2837"]


<?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>56, 'id'=>'abcd')); ?>

[/color][/size]

[size=“2”][color="#1c2837"]When you use below code it will take message field as abcd and the element will not show in array [/color][/size][color="#1C2837"][size=“2”]$_POST[‘xyz’],[/size][/color]

[size="2"][color="#1c2837"]

[/color][/size] [size="2"][color="#1c2837"]


<?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>56, 'name'=>'abcd')); ?>

[/color][/size]

[size=“2”][color="#1c2837"]When you use below code as i replace message field with name=‘message’ it will work fine and will show in array[/color][/size] [color="#1C2837"][size=“2”]$_POST[‘xyz’],[/size][/color]

[size="2"][color="#1c2837"]


<?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>56, 'name'=>'message')); ?>

[/color][/size]

so you mean id and name should be different? :unsure:

Id and Name of any element are two different things,

Here if you assign name to any element which is different to model assigned name…

Then It will not show in that model post array.

Please refer my above post.

for my other all fields i have given id and name both are same and it’s working fine but if i am setting last field name then it’s not accepting anyone fields inside $_POST[‘xyz’]… please reffere my form file and controller file…

hey anyone suggest me still i stuck with this problem… :blink: :blink: