CMPT165_25_MoreWebForms

CMPT165_25_MoreWebFo - More Web Forms Asexual form reproduction Colin Stewart 2009 Scripts that make forms in the previous lecture(More Error

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
–1 More Web Forms Asexual form reproduction © Colin Stewart, 2009 Scripts that make forms Scripts that make forms • in the previous lecture (More Error Checking), we saw how a script could print HTML to make a form • reporting errors is one reason that a script should make a form • another reason is if a large form needs to be broken into several smaller forms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–2 Scripts that make forms Scripts that make forms • why would a large form need to be split into multiple, smaller forms? • there are three reasons reason #1 : large forms can be overwhelming h 5 forms with 10 questions each is easier to use than 1 form with 50 questions h online university applications are often split into multiple forms like this h example: https://portal.bccampus.ca/ (click "Apply Online") Scripts that make forms Scripts that make forms reason #2 : sometimes, there are parts of a form that must be finished before other parts h for example, to book a flight on a plane, you must: • say when/where you want to fly ( 1 st form ) • choose an available flight ( 2 nd form ) • pay ( 3 rd form ) h you cannot do these steps in a different order
Background image of page 2
–3 Scripts that make forms Scripts that make forms reason #3 : security h when you login to a banking site, you often have to enter your username and password on separate forms h by doing this, your username and password will never be sent over the Internet together – they will always be separated b Scripts that make forms Scripts that make forms • multi-page forms generally work like this: field1 field2 option1 option2 submit 1st form: written in form. html script1. py import cgi form = cgi.FieldStorage() from file import * print 'Content-type: text/html' print print '<html>' print '<head>' print '</head>' print '<body>' print '<h1>Heading</h1>' 2nd form: made by script1. py field1 field2 submit script2. py import cgi form = cgi.FieldStorage() from file import * print 'Content-type: text/html' print print '<html>' print '<head>' print '</head>' print '<body>' print '<h1>Heading</h1>' option1 option2 submit 3rd form: made by script2. py etc.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–4 Scripts that make forms Scripts that make forms • multi-page forms generally work like this: h the first form is a regular HTML form h this form sends its data to a script • this script generates the second form h this second form sends its data to a second script, which then generates the third form h this process repeats for as many forms as are necessary h the last script will generate a page that doesn't have a form A simple example A simple example • let's start by making a multi-page login system h this will not be exactly like how the banks do it, but it's a simple first example • the system will work like this: b B
Background image of page 4
–5 A simple example A simple example • the first page is just a regular HTML form: <form action= " username.py " > <fieldset> <legend> Enter your username: </legend> <p><input type= "text" name= "username" /> <input type=
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/30/2009 for the course CMPT 165 taught by Professor Ramesh during the Summer '09 term at Simon Fraser.

Page1 / 26

CMPT165_25_MoreWebFo - More Web Forms Asexual form reproduction Colin Stewart 2009 Scripts that make forms in the previous lecture(More Error

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online