简体   繁体   中英

Echoing data from msql database to textarea in HTML

I can't figure out how to echo data stored in my mysql database into textareas in HTML. It works fine with normal text boxes, as I know text boxes take a "value" but textareas don't, but when I try to echo the data it comes up blank every time.

Here is my code for the textarea:

<tr>
     <td><label for="exampleInputName2">Caractéristiques</br>de l'écrit: </label></td>
     <td><textarea class="form-control" rows="3" name="caractéristiques" <?php echo "$donnees[caracs]";?>></textarea></td><td></td>
</tr>

Whereas this works fine with text boxes:

<input type="text" class="form-control" id="exampleInputName2" name="periode" value="<?php echo "$donnees[periode]"?>">

You need to write your code <textarea>Your text</textarea> and remove quotes from echo as its variable.

 <table> <tr> <td><label for="exampleInputName2">Caractéristiques</br>de l'écrit: </label></td> <td><textarea class="form-control" rows="3" name="caractéristiques">Here your textarea text comes<?php echo $donnees['caracs'];?></textarea></td><td></td> </tr> </table> 

Try This
 <tr>
  <td><labelfor="exampleInputName2">Caractéristiques
      </br>del'écrit</label></td>
  <td><textarea class="form-control" rows="3" name="caractéristiques" 
   ><?php echo $donnees['caracs'];?></textarea></td>
</tr>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM