如何编辑表单域中的数据?

How to edit data from form field?

当我编辑表单域中的数据时,它只有一个词 select/fetch 尽管表单域有很多词/或完整的句子哪里错了?

 <?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>

试试这个。

使用 textarea 进行长值编辑。

<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>

您可以使用TextArea 进行长值编辑。 希望下面的例子对你有所帮助。

<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>