简体   繁体   中英

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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM