duangeli1334 2018-05-21 08:35
浏览 464

如何将数据从页面获取到另一个页面,只需使用javascript在屏幕上显示即可

<style>div.container {
  max-width: 800px;
  max-height: 800px;
  display: inline-block;
}
<body>
  <h1>Your Selection</h1>
  <p>Here is the information you have submitted:</p>
  <div class="container">
    <ol>
      <li><em>AID:</em>
        <?php echo $_POST['aid']?>
      </li>
      <li><em>Date of Arrival:</em>
        <?php echo $_POST['Arrival']?>
      </li>
      <li><em>Number of Days:</em>
        <?php echo $_POST['Days']?>
      </li>
      <li><em>Number of Adults:</em>
        <?php echo $_POST['adults']?>
      </li>
      <li><em>Number of Children</em>
        <?php echo $_POST['children']?>
      </li>
      <li><em>Total:</em>
        <?php echo $_POST['Total']?>
      </li>
    </ol>
  </div>
  <div class="container" align="left">
    <form action="" method="post">
      Name : <input type="text" name="name" placeholder="Full Name" /><br> 
      Phone Number : <input type="number" name="number" placeholder="Phone Number" /><br> 
      Email : <input type="email" name="Email" placeholder="Email" /><br> 
      Address : <input type="text"
        name="Address" placeholder="Address" /><br>
      <input type="submit" value="Confirm">
      <input type="submit" value="Cancel">
    </form>
  </div>



</body>

As the code runs it will print out the information that user already select and type previously. Whenever the user clicks on submit, it will turn to receipt page and list the data on the screen.

</div>
  • 写回答

1条回答 默认 最新

  • dongzhila3786 2018-05-21 08:39
    关注

    You can use for example window.location() and send the data you want to display in the Query String. i.e:

    window.location = "http://www.home.com/page/?info=whateverYouNeed";
    

    And then you can get the query string with:

    window.href.url  
    

    There are numerous ways of doing this including using ajax to post to the backend and then retrieve it using ajax get request from the data destination page.

    I hope I understood your question right and that the answer was appropriate.

    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧