[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1
Example 15-9. PP4E\Internet\Web\tutor4.html
<html>
<title>CGI 101</title>
<body>
<H1>A second user interaction: tables
</H1>
<hr>
<form method=POST action="cgi-bin/tutor4.py">
<table>
<TR>
<TH align=right>Enter your name:
<TD><input type=text name=user>
<TR>
<TH align=right>Enter your age:
<TD><input type=text name=age>
<TR>
<TD colspan=2 align=center>
<input type=submit value="Send">
</table>
</form>
</body></html>

The <TH> tag defines a column like <TD>, but also tags it as a header column, which
generally means it is rendered in a bold font. By placing the input fields and labels in a
table like this, we get an input page like that shown in Figure 15-10. Labels and inputs
are automatically lined up vertically in columns, much as they were by the tkinter GUI
geometry managers we met earlier in this book.

Figure 15-10. A form laid out with table tags

1158 | Chapter 15: Server-Side Scripting

Do


wnload from Wow! eBook <www.wowebook.com>

Free download pdf