douzhang8033 2014-12-14 14:03
浏览 31
已采纳

如何将文本保存到页面

Normally a comment system requires the commenter to enter a comment into a textarea, than submit to post and save to the site i.e facebook commenting system. I am trying to achieve something similar. Here is my current code:

<!DOCTYPE html>
<html>
<head>
<title>Enter Comment</title>
</head>
<body>
<h1>Example</h1>

<form method="get" id="testformid">
    <input type="Share!" />
</form> 
<textarea form ="testformid" name="taname" id="taid" cols="35" wrap="soft">/textarea>

<p id="par">Hi</p>

<button id="btn1" onclick="document.getElementById('par').innerHTML =  
document.getElementById('inp').value;">Share your story!</button>

</body>
</html>

The problem I'm having is that I want the text that is printed on the white area of the site to be saved if the commenter decides to add more text instead of replacing the previous comment. Also if someone else were to comment it would join with the previous comment and become a mass text of such.

  • 写回答

1条回答 默认 最新

  • doutan2111 2014-12-14 14:12
    关注

    You need to implement server side code (I personally prefer PHP).

    You will need a database in order to do this running on SQL (PHPMyAdmin is good).

    It works like this:

    1) Connect your php script to your database

    2) Save your users comment to the database, and you would save their comments using a HTML form

    3) When a user loads your page, you need some code to display all of the rows

    Some things to read into:

    A good PHP course

    A good SQL course

    Nobody here will write you a full working program to do what you want above, youll have to do some research and learn how to use PHP and SQL

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

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来