html - getting error on browser refresh using cookies in python -


here form.html

form name="form1" action="/cgi-bin/form2.py" method="post" input type="text" name="firstname" input type="submit" value="submit" 

and below form2.py

import cgi print 'content-type:text/html\n\n' cookie=cookie.simplecookie() form = cgi.fieldstorage() searchterm = form["firstname"].value print 'set-cookie: lastvisit=' + str(searchterm) cookie["firstname"]=searchterm print "firstname="+ cookie["firstname"].value cookie_string = os.environ.get('http_cookie') if not cookie_string:       print '<p>first visit or cookies disabled</p>'  else:        print '<p>the returned cookie string "' + cookie_string + '"</p>' cookie.load(cookie_string) lastvisit = float(cookie['lastvisit'].value) cookie['lastvisit']['path'] = '/var/www/cgi-bin/' print searchterm print 'content-type:text/html\n\n' print "<meta http-equiv='refresh' content='5'>" 

we have form.html , form2.py files, form.html submitting firstname form2.py after submitting getting 'searchterm' value, refreshing browser after refresh getting <type 'exceptions.keyerror'>:firstname. though have set , retrive cookie value unable refresh browser using cookie value. please me facing problem past 4 days.

thanks, vittal.

if guess correct, first clicking on submit button, redirecting form2.py ( i.e. form.html submitting value form2.py value form["firstname"].value exists). refreshing on form2.py in turn not sending value there no submit. refreshing not mean submitting loading current page

form2.py not submitting data, how value form["firstname"].value exists


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -