I want to transfer a data from one webpage to another page. But I don’t want to use the <form method="post"> tag because there are no forms in my webpage. Just some sensitive data is there which needs to be transferred to other page.
Please answer the following questions:
- What are the ways to transfer data from one page to another?
- What are the ways to transfer data from one page to another without using
<form>tag in HTML? - How can another PHP (or ASP) page can read the data which was sent to it by another page?
That is not a good reason to avoid using a form. You can add one.
Use a query string if the data needs to be bookmarkable. Use a POST request (with a form) if it makes changes on the server (e.g. adds or edits a database entry). Use a cookie (preferably set via HTTP after using methods 1 or 2) if the data needs to persist throughout the site. Use local storage for web applications that need to function offline.
As above, but discount post requests (unless you make them using JavaScript and XMLHttpRequest).
With local storage, it can’t. All the other data is available through the server environment (
$_POST,$_GETand$_COOKIEin PHP, for example).