[英]How do i get data from a page to other page,just simply display on screen with 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.
每当用户单击“提交”时,它将转到收据页面并在屏幕上列出数据。
You can use for example window.location() and send the data you want to display in the Query String. 您可以使用例如window.location()并发送要在查询字符串中显示的数据。 ie:
即:
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. 有很多方法可以做到这一点,包括使用ajax发布到后端,然后使用ajax get请求从数据目标页面检索它。
I hope I understood your question right and that the answer was appropriate. 我希望我理解您的问题是正确的,并且答案是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.