Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating a text box field in Cakephp of array type

Can anyone help me that as i am new to CakePHP i want to create a an input box of array type.

my code is

<?php echo $this->Form->input('txt', array('type' => 'text','label' => 'Field 1')); ?>

output for this is :

<input type="text" id="AddmoreTxt" multiple="multiple" name="data[Addmore][txt]">

but i want the output like

<input type="text" id="AddmoreTxt" multiple="multiple" name="data[Addmore][txt][]">
like image 420
Surya Peddada Avatar asked Dec 01 '25 19:12

Surya Peddada


1 Answers

Put dot after your fieldName like below mentioned in code. I have checked this code.

CakePHP Code

<?php echo $this->Form->input('txt.', array('type' => 'text','label' => 'Field 1')); ?>

Output

<input type="text" id="AddmoreTxt" multiple="multiple" name="data[Addmore][txt][]">
like image 191
Sadikhasan Avatar answered Dec 03 '25 10:12

Sadikhasan