CakePHP - setting default value for input Form->: I want to have a line break, but how?

I have a form input, the default value of which I want to have as a pair of short paragraphs. For example, in my opinion:

echo $this->Form->input('story', array('default'=>'Thanks for visiting my campaign page. Be sure to check out the links below'));

At that moment, when everything works fine and a text field is created, filled with these two sentences, but I would prefer to have them on two different lines. They are also saved in the database as such, so when they are remembered, they automatically appear in two paragraphs. I tried tags <p>, etc., but they just appear in the text.

Is there a way to create a line break when setting the default value in a view that will be stored in the database as a line break, etc ...?

+5
source share
3 answers

Use \n

echo $this->Form->input('story', array('default'=>'Thanks for visiting my campaign page.\nBe sure to check out the links below'));
+9
source

And to fulfill James's answer, I would ensure that the history field is a TEXT or BLOB field in the database. If this is not the case, I would force the input text to be a text field, because there is no line break in the input text fields.

0
source

James answer works for me, I set the default value for the variable

    echo $this->Form->input('billing_fname', array('default'=>$currentuserfname));
0
source

All Articles