Python and HTML hidden input variables

Preston Landers prestonlanders at my-deja.com
Fri Oct 22 10:32:13 EDT 1999


Greetings!

You want something like this:

test = "Hello"
print "<input type=\"HIDDEN\" name=\"username\"  value=%s>" % (test)

Consult section 7.1 ("Formatting") of the Python tutorial.

yours,

---Preston

In article <7upopa$s50$1 at nnrp1.deja.com>,
  rainer2207 at my-deja.com wrote:
> 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.
>

--
|| Preston Landers <prestonlanders at my-deja.com> ||


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




More information about the Python-list mailing list