I have faced a problem. I have a form and form field name card_number. card_number comes from database. Entry Card Number that denotes card_number filed. In my ctp file I have written this.
<div class="form-group">
<label class="col-sm-2 control-label"> Entry Card Number </label>
<div class="col-md-10">
<?php echo $this->Form->input('card_number', array('options' => $readCard,'class'=>'form-control','div'=>false,'label'=>false));?>
</div>
</div>
I have written this code in my Controller. And my view looks like above image.
public function add_card_to_device($btsId = null){
$readerData = $this->CardManagement->find('list',
array(
'conditions' => array('site_name'=>$site_name),
'fields' => array('card_number'),
'keyField' => 'card_number',
'valueField' => 'card_number'
)
);
debug($readerData);
$this->set('readCard', $readerData);
if ($this->request->is('post')|| $this->request->is('put')) {
$dataa = $this->request->data;
print_r($dataa);
}
}
The problem is occurred when I click submit button. When I click the submit button I get these value. I get the id value instead of card_number [card_number] => 5a13b3d9-67ac-4847-b3f9-1870991894ac
Array ( [CardManagement] => Array ( [id] => 5a12d321-a7e0-4cf6-ab84-1870991894ac [site_name] => 1235 [card_number] => 5a13b3d9-67ac-4847-b3f9-1870991894ac ) )
But my desired output looks like this. [card_number] => 6473088
Array ( [CardManagement] => Array ( [id] => 5a12d321-a7e0-4cf6-ab84-1870991894ac [site_name] => 1235 [card_number] => 6473088 ) )
Any solution or suggestion please.
