doutanggun9816 2015-04-11 06:14
浏览 10

如何使POST值永远与另一个值保持一致?

I am making a website editor and I need to make a box where you can type and it will submit it to the page. Now I have done that but when I refresh that page, the value expires and disappears, I have tried making a SESSION value and it remained the same problem. Can anyone help?

<script type="text/javascript">
tinymce.init({
    selector: "textarea",
    plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu   paste"
    ],
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
</script>

<form method="post" action="../">
    <textarea name="content" style="width:100%"></textarea>
    <br>
    <input class="btn btn-lg btn-primary btn-block" type="submit" value="Save" />
</form>

I want to submit it to the index, which it is and save that value forever.

  • 写回答

2条回答 默认 最新

  • duanlinma5885 2015-04-11 06:34
    关注

    First of all you have to initialize session if you want to keep track of your objects. Then you can save there anything:

    <?php
      session_start ();
      if(isset($_POST)){
        $_SESSION['content'] = $_POST['content'];
      }
      echo $_SESSION['content'];
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据