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 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器