dqsa17330 2018-01-17 04:54
浏览 48
已采纳

使用输入标记html显示从表到编辑的数据

Currently i am still trying to get used with html and php codes. I have created a page that display all contents from database into table that can be edited for each row. When the edit button is clicked it will go to the next page to edit the data. Basically to edit, the content should be displayed on the edit page. Some content might be long so i wanted to use the <textarea> to fetch them because if i use the <input> tag the height cannot be adjusted means the content is displayed only in one line. But then when i used the <textarea> tag, it wont display anything at all. It didnt fetch the data. So i wonder if i missed something? I need to fetch/display the content from table with multiple lines. Here is part of code in my edit page.

 <form method="post">
     <table>
         <tr>
             <td>No Seq</td>
             <td><input type="text" name="id" value="<?php echo $id;?>"></td>
         </tr>
         <tr>
             <td>Department</td>
             <td> <select  name="department" style="width: 452px;" value="<?php echo $department; ?>">
                  <option value="IT">it</option>
                  <option value="purchasing">purchasing</option>
                  <option value="finance">finance</option>
             </td>
         </tr>
         <tr>
             <td>Person in Charge</td>
             <td> </td>
         </tr>
         <tr>
             <td>Project Title</td>
             <td> <input type="text" name="project_title" size="60" value="<?php echo $project_title;?>"> </td>
         </tr>
         <tr>
             <td>Objective</td>
             <td> <textarea type="text" name="objective" style="height: 50px; width: 445px;" value="<?php echo $objective;?>"> </textarea> </td>
         </tr>
         <tr>
             <td>How To Do</td>
             <td> <textarea type="text" name="how_to_do" size="60" style="height: 110px; width: 445px;" value="<?php echo $how_to_do;?>"> </textarea></td>
         </tr>
         <tr>
             <td>Activities</td>
             <td> <textarea type="text" name="activities" size="60" style="height: 110px; width: 445px;" value="<?php echo $activities;?>"> </textarea></td>
         </tr>
         <tr>
             <td>Project Started</td>
             <td> <input type="date" name="prostart" size="60" style="width: 445px;" value="<?php echo $project_started;?>"></td>
         </tr>
         <tr>
             <td>Project Completed</td>
             <td> <input type="date" name="procomplete" size="60" style="width: 445px;" value="<?php echo $project_completed;?>"></td>
         </tr>
         <tr>
             <td>Target Cost Saving</td>
             <td><input type="text" name="targetcost" size="60" value="<?php echo $target_cost_saving;?>"></td>
         </tr>
         <tr>
             <td>Cost Saving After Justification</td>
             <td><input type="text" name="costafter" size="60" value="<?php echo $costsaving_afterjustification;?>"></td>
         </tr>
         <tr>
             <td>Cost Saving Monthly After Justification</td>
             <td><input type="text" name="costmonthly" size="60" value="<?php echo $costsaving_monthly?>"></td>
         </tr>
     </table>
     <br> <br>
     <input style="width: 80px; height: 30px; margin-left: 750px;" type="submit" name="update" value="Cancel" acti>
     <input style="width: 80px; height: 30px;" type="submit" name="update">
 </form> <br>

</div>
  • 写回答

1条回答 默认 最新

  • dongpang9573 2018-01-17 05:02
    关注

    TEXTAREA do not accept the parameter value=, to set a default content for TEXTAREA, you need to insert the data between the tags, as example below:

    <textarea type="text" name="objective" style="height: 50px; width: 445px;"><?php echo $objective;?></textarea>
    

    See also: https://www.w3schools.com/tags/tag_textarea.asp

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类