View Single Post
Old Nov 22nd, 2006, 3:15 AM   #1
public2
Newbie
 
Join Date: Aug 2006
Posts: 13
Rep Power: 0 public2 is on a distinguished road
Use cookie in form

Hi there.

I'm working on a Python program where I load a form with text fields and then save input as a cookie. I print my HTML code by doing:

print content-type: text/html
print '''
<html><head><title>......
<form>
  <input name="replace" type="text" size="25" value=""/>
</form>.....'''
if os.environ.has_key('HTTP_COOKIE'):
    cookie.load(os.environ['HTTP_COOKIE'])
    if cookie.has_key('url') and cookie.has_key('find') and cookie.has_key('replace'):
      print cookie['mycookie']
print '</body></html>'

I have two questions. One is that my cookies are not replaced by the newest search words. I just have the first cookie from the first search I did with my script.

Second question and hurtle is, that I want my value="" in my form to have the last word I've entered in my text field, that is my cookie for "mycookie". I can post the whole code if it's easier for you to see my problem and/or explain what I'm doing wrong.

Greetings Public2
public2 is offline   Reply With Quote