2

I have created a form by using the below code.

<?php $this->Form->create('Course'); ?>

Form text element is displaying with label by the following...

<?php $this->Form->input('code'); ?>

But i don't want to show the label of the text field.
what changes should be made in the above coding?

3 Answers 3

5

if you want to change the label, use this.

$this->Form->input('code', array('label' => 'LabelName'));
Sign up to request clarification or add additional context in comments.

Comments

4

if you want to remove the label you need to use:

   <?php echo $this->Form->input('code', array('label' => false)); ?>

For a full control of the label of an input, the best way is to use it like this:

   <?php echo $this->Form->input('code',array('label'=>array('text'=>'This is my label','class'=>' this is the class of my label'))); ?>

Comments

1

$this->Form->input('code', array('label' => false));

Or, if you wanted to change the label to something else of your choosing:

$this->Form->input('code', array('label' => 'something else'));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.