开发者

HTML textarea: How to display text with newline, spacing?

开发者 https://www.devze.com 2023-02-16 20:24 出处:网络
I have a \'pre-populated\' text area, where I want something in the order of: Hi, enter开发者_StackOverflow中文版 some text here

I have a 'pre-populated' text area, where I want something in the order of:

Hi, enter开发者_StackOverflow中文版 some text here
    And press submit:)

(Just as example, I know it sounds stupid) ...To be displayed on page load. If I enter it verbatim in the HTML it displays as:

Hi, enter some text here

And press submit:)

Any ideas? thanks.


You need to have a tab in there

$val = "Hi, enter some text here \n \tAnd press submit:)"; //adds a newline and tab

And your HTML

<textarea>
<?php echo $val ?>
</textarea>

You might have to modify this a bit by adding placeholders if you want the tab characters to appear in different places.

0

精彩评论

暂无评论...
验证码 换一张
取 消