CMPT165-Final Exam Review Example.docx

324 views4 pages
CMPT165 Final Exam Review Example-Phone Book Form
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<h1>Virtual Phone Book</h1>
<form action ="">
<p>Name: <input type:"text" name="name"></p>
<p>Phone #: <input type:"text" name="number"></p>
<p>Type of Phone:</p>
<p><input type="radio" name="type" value="Cell"></p>
<p><input type="radio" name="type" value="Work"></p>
<p><input type="radio" name="type" value="Landline"></p>
<p><input type="submit" value="Add!"></p>
from file import*
import cgi
form = cgi.FieldStorage()
print "Content-type: text/html"
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"
print "<title></title>"
print "</head>"
print "<body>"
name = form["name"].value
phone# = form["phone#"].value
phoneType = form["type"].value
newPhone = [phone#, phoneType]
phoneList = [newPhone]
newPhoneProfile = [name, phoneList]
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Grade+

Unlimited access to all notes and study guides.

Grade+All Inclusive
$10 USD/m
You will be charged $120 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.