Submit and Succeed: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 24: Line 24:
print """
print """
<html>
<html>
<head></head>
<head>
<style>
textarea {{
    font-size: 32px;
    width: 100%;
    border: 4px solid black;
    height: 400px;       
}}
</style>
</head>
<body>
<body>
<form action="success.cgi">
<form action="success.cgi">
     <textarea name="text" style="font-size: width: 100%; border: 4px solid black; height: 100px">{0}</textarea>
     <textarea name="text">{0}</textarea>
     <input type="submit">
     <input type="submit">
</form>
</form>

Revision as of 15:29, 17 November 2011

Some examples of regular expressions

Behold the self-posting form:

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import cgi
import cgitb; cgitb.enable()

query = cgi.FieldStorage()
text = query.getvalue("text", "")

## Alter text here
text = text.upper()

print "Content-type: text/html"
print
print """
<html>
<head>
<style>
textarea {{
    font-size: 32px;
    width: 100%;
    border: 4px solid black;
    height: 400px;        
}}
</style>
</head>
<body>
<form action="success.cgi">
    <textarea name="text">{0}</textarea>
    <input type="submit">
</form>
</body>
</html>
""".format(text)

Afternoon Tutorial

  • Eleanor