Python and HTML hidden input variables

rainer2207 at my-deja.com rainer2207 at my-deja.com
Fri Oct 22 09:28:12 EDT 1999


I have a Python script which displays a form and has a hidden input. The
relevant code part looks something like this:

print "<form method=\"post\" action=\"sendmsg.cgi\">"
print "<textarea name=\"sndmsg\" rows=\"7\" cols=\"73\" nowrap>"
print "</textarea>"
print "<input type=\"HIDDEN\" name=\"username\"  value="test">"
print "<br>"
print "<input type=\"submit\" value=\"Talk\">"
print "</form>"

I was wondering how I could pass a variable using the hidden field. That
is I'd like to do something like this:

test = "Hello"
print "<input type=\"HIDDEN\" name=\"username\"  value=test>"

but this returns the string test rather than "Hello". Is there anyway
I can get it to pass "Hello"? Am I right in leaving out the double
quotes for the value part? Any help would be appreciated. Thanks.



Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list