But you *CAN* send data from one HTML page to the next. You can't use method="post"
(post is reserved for server-side usage), but you can use method="get"
. The second page can read the querystring thus created by the form sending on the first page.
You could also send data from one page to another via cookies, of course. But the querystring works well enough for most purposes.
Here's how I do it:
<title>This is page 1</title>
<form method="get" action="page2.html">
Name: <input name="username" /><br/>
Phone: <input name="phone" /><br/>
and then the second page:
<title>This is page 2</title>
The username is <span id="uname"></span><br/>
The phone is <span id="uphone"></span><br/>
var qs = [ ];
var qstring = location.search;
if ( qstring.length > 1 )
var pairs = qstring.substring(1).split("&");
for ( var p = 0; p < pairs.length; ++p )
var pair = pairs[p].split("=");
qs[ pair.toLowerCase() ] = decodeURIComponent( pair.replace(/\+/g," ") );;
document.getElementById("uname").innerHTML = qs["username"];
document.getElementById("uphone").innerHTML = qs["phone"];
The JS code in red is what is used to receive and decode the querystring. The qs
object thus becomes a simple "lookup" object that allows you to easily find any of the passed "GET" values from the form on the first page.