View Single Post
Old Nov 27th, 2006, 2:14 AM   #4
public2
Newbie
 
Join Date: Aug 2006
Posts: 13
Rep Power: 0 public2 is on a distinguished road
The solution was:

Question 1: To make a cookie from my input forms, I had to set it up like this:

cookie = Cookie.SimpleCookie()
    if form.has_key('form1') and form.has_key('form2') and form.has_key('form3'):
      cookie['form1'] = form['form1'].value
      cookie['form1']['expires']=25920000
      cookie['form2'] = form['form2'].value
      cookie['form2']['expires']=25920000
      cookie['form3'] = form['form3'].value
      cookie['form3']['expires']=25920000
      print cookie

Then i use my cookies as arguments when I call my HTMLbody function:

HTMLbody(cookie['form1'].value,cookie['form2'].value,cookie['form3'].value)

I my HTML body, I write my HTML out, and use my cookies with the %-function, like this:

<div>
<label for="t1">FORM1:</label><input type="text" name="form1" id="t1" value="%s"/><br />
<label for="t2">FORM2:</label><input type="text" name="form2" id="t2" value="%s"/><br />
<label for="t3">FORM3:</label><input type="text" name="form3" id="t3" value="%s"/><br /> 
</div>
Notice that I my value fields, I've used %s (that return a string). What to put inside my %s I define after my HTML code, so it looks like this:

<div>
<label for="t1">FORM1:</label><input type="text" name="form1" id="t1" value="%s"/><br />
<label for="t2">FORM2:</label><input type="text" name="form2" id="t2" value="%s"/><br />
<label for="t3">FORM3:</label><input type="text" name="form3" id="t3" value="%s"/><br /> 
</div>
</fieldset>
<div><input type="submit" value="SEARCH" id="submit" /></div>
</form>
</center>
</body></html>''' %(form1cookie,form2cookie,form3cookie)
public2 is offline   Reply With Quote