Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import cgi
- import cgitb; cgitb.enable()
- form = cgi.FieldStorage()
- new = open("survey.ssv", "r+")
- new.write(form.getvalue("surveyQuestion")+"n")
- new.seek(0)
- lines = new.readlines()
- i = 0
- print "Content-type:text/htmlrnrn"
- print "<html>"
- print "<head>"
- print "<title>Create-a-Survey!</title>"
- print "</head>"
- print "<body bgcolor='white' text='black'>"
- print "<center>"
- print "<h1>Create Survey Page</h>"
- print "</center>"
- print "To create a survey first input a title in the 'Survey Title' text box. To add questions, write a question in the 'Survey Question' text box and click the 'Add' button. If you want to create a new survey, write a new survey title and click 'New'. The 'Done' button will end the survey creation and return you to the welcome page."
- print "<br><br>"
- for line in lines:
- if i == 0:
- print "Current Survey Title:<br>%s" % line
- print "<br><br>"
- print '<form action="newSurvey.py" method="post">'
- print 'Survey Title:<br><input type="text" name="surveyTitle">'
- print '<input type="submit" name="decision" value="New">'
- print '</form>'
- print '<br><br>'
- else:
- print "Question %d:<br>%s" % i, % line
- print '<br><br>'
- i = i + 1
- new.close()
- print '<form action="addQuestion.py" method="post">'
- print 'Survey Question:<br><input type="text" name="surveyQuestion">'
- print '<br><br>'
- print '<input type="submit" name="decision" value="Add">'
- print '</form>'
- print '<form action="doneSurvey.py" method="post">'
- print '<input type="submit" name="decision" value="Done">'
- print '</form>'
- print '<a href="welcome.html">Back to welcome page</a>'
- print '</body>'
- print '</html>'
- #!/usr/bin/python
- import cgi
- import cgitb; cgitb.enable() # enable debugging mode
- form = cgi.FieldStorage()
- new = open("survey.ssv", "r+")
- new.write(form.getvalue("surveyQuestion")+"n")
- lines = new.readlines()
- i = 0
- print "Content-type:text/htmlrnrn"
- print "<html>"
- print "<head>"
- print "<title>Create-a-Survey!</title>"
- print "</head>"
- print "<body bgcolor='white' text='black'>"
- print "<center>"
- print "<h1>Create Survey Page</h>"
- print "</center>"
- print "To create a survey first input a title in the 'Survey Title' text box. To add questions, write a question in the 'Survey Question' text box and click the 'Add' button. If you want to create a new survey, write a new survey title and click 'New'. The 'Done' button will end the survey creation and return you to the welcome page."
- print "<br><br>"
- for line in lines:
- if i == 0:
- print "Current Survey Title:<br>%s" % line
- print "<br><br>"
- print '<form action="newSurvey.py" method="post">'
- print 'Survey Title:<br><input type="text" name="surveyTitle">'
- print '<input type="submit" name="decision" value="New">'
- print '</form>'
- print '<br><br>'
- else:
- print "Question %d:<br>%s" % i, % line
- print '<br><br>'
- i = i + 1
- new.close()
- print '<form action="addQuestion.py" method="post">'
- print 'Survey Question:<br><input type="text" name="surveyQuestion">'
- print '<br><br>'
- print '<input type="submit" name="decision" value="Add">'
- print '</form>'
- print '<form action="doneSurvey.py" method="post">'
- print '<input type="submit" name="decision" value="Done">'
- print '</form>'
- print '<a href="welcome.html">Back to welcome page</a>'
- print '</body>'
- print '</html>'
- print "Question %d:<br>%s" % i, % line
- print "Question %d:<br>%s" % (i, line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement