Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使生成的内容保持在页面上,以便多用户交流?_Javascript_Php_Session Cookies_Forum - Fatal编程技术网

Javascript 使生成的内容保持在页面上,以便多用户交流?

Javascript 使生成的内容保持在页面上,以便多用户交流?,javascript,php,session-cookies,forum,Javascript,Php,Session Cookies,Forum,特别是用于此应用程序的addElement和addText函数。 我希望多个用户能够阅读彼此的帖子。 我还实现了附带getfile.php页面的图像上传 <?php $pgHeading="Pyramid Image Board - A frontier of free speech"; $pgDesc="An image board made from the ground up by an unqualified programmer.";

特别是用于此应用程序的addElement和addText函数。 我希望多个用户能够阅读彼此的帖子。 我还实现了附带getfile.php页面的图像上传

     <?php 
    $pgHeading="Pyramid Image Board - A frontier of free speech"; 
    $pgDesc="An image board made from the ground up by an unqualified 
    programmer.";            
    $pgKeywords="Chan, Image Board, Trade media, Internet Talk"; 
    ?>
    <html>
    <meta name="description" content="<?php echo $pgDesc ?>"></meta> 
    <meta name="keywords" content="<?php echo $pgKeywords ?>"></meta> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    </meta>      
    <body>
    <header>
    <link rel="stylesheet"   href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
  <script>
  function addtext() {
  var newtext = document.myform.inputtext.value;
  document.myform.outputtext.value += newtext;
    }

  function addElement() {

   var ni = document.getElementById('myDiv');

   var numi = document.getElementById('theValue');

    var num = (document.getElementById('theValue').value - 1) + 2;

    numi.value = num;

     var newdiv = document.createElement('div');

     var divIdName = 'Post#' + num + ":";

     newdiv.setAttribute('id', divIdName);

    newdiv.innerHTML = (divIdName) + document.myform.inputtext.value;
    ni.appendChild(newdiv);
     }
      </script>
      <style>

      #LL {
       position: relative;
       color: #00AABB;
       }

       div {
       margin: 0 auto;
       color: black;
      border-radius: 8px;
       background: linear-gradient(white, white, gray);
       padding-top: 0px;
       width: 600px;
       height: 55px;
        }

       #fs {
       margin: 0 auto;
       border-radius: 9px;
       width: 603px;
       background: linear-gradient(white, grey, white);

        }

        .clearfix {
         overflow: auto;
          }

          #textbox {
          height: 90px;
          width: 560px;
          border-radius: 6px;
          margin-left: 18px;
          }

          #post {
          border-radius: 7px;
          position: relative;
          left: 437px;
          color: black;
          }

           #inforce {
           position: fixed;
           top: 24px;
           left: 14px;
            }
            </style>

            </header>
           <fieldset id="fs">
           <input type="hidden" value="0" id="theValue" />
            <legend id=LL>. .<span id="inforce">.</span>
            </legend>
        <form enctype="multipart/form-data" action="getfile.php"  method="post" name="myform">
     <textarea id="textbox" type="text" size="50" name="inputtext" />
     </textarea>

 <input type="file" name="uploadFile">
 <input type="hidden" name="MAX_FILE_SIZE" value="25000" />
 <input type="submit" value="Upload File">
     <button class="btn btn-info" id="post" onClick="addtext()">
        <a value="Add New Text" href="javascript:;" onclick="addElement()">
  POST
   </a>
     </button>
    </fieldset>
      <span>
       <div id="myDiv">

         </div>
        </form>
        </span>
        </form>
        </body>
        </html



        //and here is the getfile.php// 

        <html>
        <head>
        <title>Process Uploaded File</title>
        </head>
        <body>
        <?php
        if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], 
        "/home/ubuntu/workspace/uploads/{$_FILES['uploadFile'] ['name']}")  )
        {  print '<p> The file has been successfully uploaded </p>'; 
        header('Location:index.php');                    
              }
           else
             { 
        switch ($_FILES['uploadFile'] ['error'])
        {  case 1:
               print '<p> The file is bigger than this PHP installation    
                    allows</p>';    break;
        case 2:
               print '<p> The file is bigger than this form allows</p>';
               break;
        case 3:
               print '<p> Only part of the file was uploaded</p>';
               break;
        case 4:
               print '<p> No file was uploaded</p>';
               break;
                   }
                  }
              ?>
                 </body>
                  </html>


你需要在服务之前用php修改html文件,或者做一些动态的事情。你今天刚刚开始使用php,这不是很直接。你需要在服务之前用php修改html文件,或者做一些动态的事情。你今天刚开始使用php,这不是很直接