开发者

Write a load of strings from a MySQL DB to a input area in PHP

开发者 https://www.devze.com 2023-02-04 12:38 出处:网络
Hi so i was wondering how do i get a load of string from a mysql database and put them in a input area with a return between 开发者_如何转开发each value such as

Hi so i was wondering how do i get a load of string from a mysql database and put them in a input area with a return between 开发者_如何转开发each value such as

Hi

My

Name

Is

Joris

Thanks,

Joris


When you're creating a <textarea> in a form, the text between the <textarea> and </textarea> tags is the default text for the text area. You just need to build a pair of these with the string you want between them, like this: <textarea>$string</textarea>. Do the query and the concatenating in PHP using \n for newlines.


You can simply add a carriage return after each string and then output this within the required textarea.

For example:

<?php
    $cr = "\n";
    $bigString = 'Hello' . $cr . 'there.';

    echo '<textarea>' . $bigString . '</textarea>';
?>
0

精彩评论

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