duanjia2415 2014-11-12 06:40
浏览 31
已采纳

如何在textarea中显示来自DB的数据

In the following code, I can display the values from the DB in text boxes but how would I display them in the textarea?

<form action="" method="post">
  <input type="hidden" name="id" value="<?php echo $id; ?>"/>
  <div>
     <p>
     <strong>ID:</strong>    
     <?php echo $id; ?>
     </p>
     <strong>userid: </strong>    
     <input type="text" name="userid" value="<?php echo $userid; ?>" /><br/>
     <strong>name: </strong>     
     <input type="text" name="name" value="<?php echo $name; ?>" /><br/>
     <strong>phoneno: </strong>      
     <input type="text" name="phoneno" value="<?php echo $phoneno; ?>" /><br/>
     <strong>emailid: </strong> 
     <input type="text" name="emailid" value="<?php echo $emailid; ?>" /><br/>
     <strong>description: </strong>    
     <textarea name="description" value="<?php echo $description; ?>" rows="5" cols="40">    </textarea>
</form> 
  • 写回答

4条回答 默认 最新

  • dongmu1951 2014-11-12 06:42
    关注

    Just put it in the tags like this:

    <textarea name="description" rows="5" cols="40"><?= $description; ?></textarea>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • douqin7086 2014-11-12 06:42
    关注

    It is not the value in text area use this

    <textarea name="description" rows="5" cols="40"><?php echo $description; ?></textarea>
    
    评论
  • donte1234567 2014-11-12 06:42
    关注

    Change this

    <textarea name="description" value="<?php echo $description; ?>" rows="5" cols="40"></textarea>
    

    To

    <textarea name="description"  rows="5" cols="40"><?php echo $description; ?></textarea>
    
    评论
  • douji1999 2014-11-12 06:45
    关注
    <textarea name="description"><?php echo $description; ?></textarea>
    
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 我需要在PC端 开两个抖店工作台客户端.(语言-java)
  • ¥15 有没有哪位厉害的人可以用C#可视化呀
  • ¥15 可以帮我看看代码哪里错了吗
  • ¥15 设计一个成绩管理系统
  • ¥15 PCL注册的选点等函数如何取消注册
  • ¥15 问一下各位,为什么我用蓝牙直接发送模拟输入的数据,接收端显示乱码呢,米思齐软件上usb串口显示正常的字符串呢?
  • ¥15 Python爬虫程序
  • ¥15 crypto 这种的应该怎么找flag?
  • ¥15 代码已写好,求帮我指出错误,有偿!
  • ¥15 matlab+波形匹配算法