Reputation: 195
i want change the name of the input to make it name=data[Contact][firstname]
because I want to display the data when i click edit() i guess that is the reason why it is not displaying. echo $this->Form->input('First Name:', array('class'=>'form-control'));
the name of the input is same n the first param. please help
Upvotes: 0
Views: 1596
Reputation: 57
The first parameter is the name of the input field (name="firstname"). It is not the label (First name: ). so your code should be,
$this->Form->input('firstname', array('class'=>'form-control'));
To get this structure [Contact][firstname], your form name should be 'contact'.
$this->Form->create('Contact',array('class'=>'form'));
$this->Form->input('firstname', array('class'=>'form-control'));
Upvotes: 1
Reputation: 400
Your code should be like this:
echo $this->Form->input('firstname', array('class'=>'form-control','label'=>'First Name'));
Upvotes: 1