Problems Making Echo of a Textarea Notebook

Asked

Viewed 31 times

0

I created a Notebook Textarea to record important information of the day. By doing echo within the Notebook Textarea creates a different one for each row inserted in the database table, as shown in the image:

inserir a descrição da imagem aqui

But what I want is to return the lines of the database but always within the same Notebook Textarea.

Code:

$query = "SELECT * FROM raddb.Informacao WHERE DATE(data) = CURDATE() ORDER BY data Desc";

$result = $conn->query($query) or die($conn->error);

<div class="table-responsive">
<form id="paper" method="post" action="">
<div class="form-group input-group input-group-lg">
<span class="input-group-addon">
<span class="glyphicon glyphicon-blackboard"></span>
Informações do Dia</span>
</div>
<?php
while($row = mysqli_fetch_array($result))  
{
?>
<textarea id="text" name="text" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px;" readonly="true"><?php echo $row["text"]; ?></textarea> 
<?php
}
?>    
</form>
</div> 

1 answer

4


Use PHP_EOL (from PHP 5.0.2) to break the lines, but loop inside the textarea not to repeat it:

<textarea id="text" name="text" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px;" readonly="true">
<?php
while($row = mysqli_fetch_array($result)){
   echo $row["text"].PHP_EOL;
}
?>    
</textarea>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.