如何每次都在新的文本区域显示反馈



我从数据库中提取数据并显示在文本区域中。所有人的数据都显示在一个文本区域。我想每次都在新的文本区域显示每个人的数据。我该怎么办?

<form>
<marquee><textarea class="textarea" rows="5" cols="30" >
<?php
$conn=mysqli_connect("localhost","root","","feedback");
if($conn-> connect_error){
die("Connection field:". $conn-> connection_error);
}
$sql="SELECT customer,restuarant,title,comment from fedbk";
$result=$conn->query($sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
echo  $row["customer"]."n"; 
echo $row["restuarant"]."n".$row["title"]."n".$row["comment"]."n";
} 
} else {
echo"0 result";
}
$conn->close()
?>
</textarea></marquee>
</form>

您所做的是,您调用单个文本区域,并在其中显示所有客户价值。但您希望为每个客户显示单独的文本区域。所以你可以像一样

<form>
<marquee>
<?php
$conn=mysqli_connect("localhost","root","","feedback");
if($conn-> connect_error){
die("Connection field:". $conn-> connection_error);
}
$sql="SELECT customer,restuarant,title,comment from fedbk";
$result=$conn->query($sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
echo '<textarea class="textarea" rows="5" cols="30" >';
echo  $row["customer"]."n"; 
echo $row["restuarant"]."n".$row["title"]."n".$row["comment"]."n";
echo '</textarea></br>';
} 
} else {
echo"0 result";
}
$conn->close()
?>
</marquee>
</form>

顺便说一句,根据MDN的说法,marquee已经过时了。

<?php
$conn=mysqli_connect("localhost","root","","feedback");
if($conn-> connect_error){
die("Connection field:". $conn-> connection_error);
}
$sql="SELECT customer,restuarant,title,comment from fedbk";
$result=$conn->query($sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
<textarea class="textarea" rows="5" cols="30" >
echo  $row["customer"]."n"; 
echo $row["restuarant"]."n".$row["title"]."n".$row["comment"]."n"; 
</textarea>
} 
} else {
echo"0 result";
}
$conn->close()
?>

最新更新