douhuang7263 2018-01-19 05:15 采纳率: 100%
浏览 67
已采纳

如何从表单字段编辑数据?

when i edit data from form field it only select/fetch one word though form field has many words/ or complete sentence where is wrong?

 <?php
 //getting id from url
 $id = $_GET['id'];

 //selecting data associated with this particular id
 $result = mysql_query("SELECT * FROM list WHERE id=$id");

  while($res = mysql_fetch_array($result))
 {
  $Test_name = $res['Test_name'];

  }
  ?>

 <form name="form1" method="post" action="edit.php">
    <table border="0">


        <tr> 
            <td>Test Name</td>
            <td><input type="text" name="Test_name" value=<?php echo 
             $Test_name;?>></td>
        </tr>

        <tr>
            <td><input type="hidden" name="id" value=<?php echo 
             $_GET['id'];?>></td>
            <td><input type="submit" name="update" value="Update"></td>
        </tr

    </table>
    </form>
  • 写回答

2条回答 默认 最新

  • dongzhi2887 2018-01-19 05:21
    关注

    You can use TextArea for long value edit. Hope below example will help you.

    <form name="form1" method="post" action="edit.php">
        <table border="0">
    
    
            <tr> 
                <td>Test Name</td>
                <td><textarea name="Test_name" value=<?php echo 
                 $Test_name;?>><?php echo 
                 $Test_name;?></textarea></td>
            </tr>
    
            <tr>
                <td><input type="hidden" name="id" value=<?php echo 
                 $_GET['id'];?>></td>
                <td><input type="submit" name="update" value="Update"></td>
            </tr
    
        </table>
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作