Reputation: 539
I want to transfer data from one to another pages, like my login detail are display in another page then what can I do
My Python Server code:
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
from urlparse import urlparse, parse_qs
class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
def do_POST(self):
try:
length = int(self.headers.getheader('content-length'))
data = self.rfile.read(length)
self.send_response(200, "OK")
print data.split('&')
#process_data(data, self.client_address)
except Exception as inst:
logging.error(type(self).__name__ + "/" + type(inst).__name__ + " \
(" + inst.__str__() + ")")
if __name__ == '__main__':
BaseHTTPServer.HTTPServer(('\
', 8544), CustomHTTPRequestHandler).serve_forever()
My Html First file index.html
<form action="" method="POST">
User Name :
<input type="text"id="username" name="username" placeholder="Enter User Name">
Password :
<input type="password" id="password" name="password" laceholder="Enter Password">
<button type="submit" id="submit">Sign in</button>
</div>
</div>
</form>
In second HTML file (index2.html) I want to display data which is entered into the index.html
For that things I search so many thread but I'm not success to found or some of I'm not understand so please help me what changes are into server or any thing else.
Upvotes: 1
Views: 836
Reputation: 1633
The standard way of doing this is with cookie based sessions. That is, on the initial request the web server provides the client with a session cookie. That cookie gets stored in the users web browser for the duration of the browsing session.
All subsequent HTTP requests include that session ID (which is basically a random, un-guessable string). The server then uses that session ID to retrieve whatever information is on the server associated with the particular client (e.g. contents of shopping cart).
I suggest you read up about cookies here: http://en.wikipedia.org/wiki/HTTP_cookie
Upvotes: 1