Administering a Poll
Example
- Collecting and displaying visitor preferences for presidential candidates.
MGI Tags
Steps
- Create a poll page.
- Save the poll page.
- Open the poll page in a text editor.
- Insert the mgiPoll tag.
- Save the poll page.
- Create a poll format file in a text editor.
- Save the poll format file.
- Create a poll results page.
- Save the poll results page.
- Open the poll results page in a text editor.
- Insert the mgiPoll tag from the mgiPoll page.
- Insert a new mgiPoll tag to display results.
- Save the poll results page.
- FTP the poll page and poll results page to the web server running MGI.
- Complete and submit the poll.
Step 1: Create a poll page.
- Create a new HTML page to display the poll questions. The poll questions
will be generated by the mgiPoll tag and the poll format file, but any
headers or footers should be entered on this page. For example, enter a
header labelled "Election Poll":
<H2>Election Poll</H2>
Step 2: Save the poll page.
- Save the poll page and name it "poll.html".
Step 3: Open the poll page in a text editor.
- Open the poll page in a text editing program that allows you to view
and modify HTML.
Step 4: Insert the mgiPoll tag.
- Insert your cursor after the "Poll" heading and enter the
mgiPoll tag, databaseFileLocation parameter, tableName parameter, and formatFileLocation
parameter. In the databaseFileLocation parameter, enter the name of a database
file. If the file does not exist already, MGI will create a new database
file. For example, enter "Surveys" in the databaseFileLocation
parameter. In the tableName parameter, enter the name of the specific survey
that you are administering. For example, enter "Election2000"
in the tableName parameter. In the formatFileLocation parameter, enter
the name of the file that contains the format of the poll questions. For
example, enter "pollformat.txt" in the formatFileLocation parameter.
<mgiPoll databasefilelocation="Surveys" tableName="Election2000"
formatFileLocation="pollformat.txt">
Step 5: Save the poll page.
- Save the changes you have made to the poll page.
Step 6: Create a poll format file in a text editor.
- Create a new page in a text editing program to format poll questions.
Enter HTML form fields for each poll question, a submit button and HTML
<FORM> tags. Format each poll question as text, HTML, and form elements
including radio buttons, checkboxes and pop-up menus (do not use text fields
or text boxes). Name each set of form elements with a unique name and each
option with an appropriate value. When you display poll results, the value
of each option is used as a label. In the example election poll, there
are three questions formatted with radio buttons and a pop-up menu in colored
tables. Enter an HTML submit button after the poll questions. For example,
enter a submit button named "Submit Answers". A form action sends
the poll information to the poll results page for processing. Enter the
name of the poll results page, "pollresults.html", in the form
action. Enter "post" as the form method. The following is the
complete election poll format file:
-
<FORM ACTION="pollresults.html" METHOD="POST">
<CENTER>
<!--Question 1-->
<TABLE WIDTH="300" CELLPADDING="5">
<TR>
<TD WIDTH="100%" BGCOLOR="#00ff00">
If you had to vote today, who would you choose to represent
the Republican party in the next presidential election?</TD></TR>
<TR>
<TD WIDTH="100%" BGCOLOR="#ccffcc">
<P><INPUT TYPE="radio" VALUE="Pat Buchanan" NAME="Republican">
Pat Buchanan</P>
<P><INPUT TYPE="radio" VALUE="George W. Bush" NAME="Republican">
George W. Bush</P>
<P><INPUT TYPE="radio" VALUE="Elizabeth Dole" NAME="Republican">
Elizabeth Dole</P>
<P><INPUT TYPE="radio" VALUE="Other" NAME="Republican">
Other</TD></TR>
</TABLE>
<!--Question 2-->
<TABLE WIDTH="300" CELLPADDING="5">
<TR>
<TD WIDTH="100%" BGCOLOR="#ffff00">
If you had to vote today, who would you choose to represent
the Democratic party in the next presidential election?</TD></TR>
<TR>
<TD WIDTH="100%" BGCOLOR="#ffffcc">
<P><INPUT TYPE="radio" VALUE="Hillary Clinton" NAME="Democrat">
Hillary Clinton</P>
<P><INPUT TYPE="radio" VALUE="Dick Gephart" NAME="Democrat">
Dick Gephart</P>
<P><INPUT TYPE="radio" VALUE="Al Gore" NAME="Democrat">
Al Gore</P>
<P><INPUT TYPE="radio" VALUE="Other" NAME="Democrat">
Other</TD></TR>
</TABLE>
<!--Question 3-->
<TABLE WIDTH="300" CELLPADDING="5">
<TR>
<TD WIDTH="100%" BGCOLOR="#00ccff">What is your age?</TD></TR>
<TR>
<TD WIDTH="100%" BGCOLOR="#ccffff"><SELECT NAME="Age">
<OPTION SELECTED>18 to 25
<OPTION>26 to 35
<OPTION>36 to 45
<OPTION>46 to 55
<OPTION>56 to 65
<OPTION>over 65
</SELECT></TD></TR>
</TABLE>
<INPUT NAME="name" TYPE="submit" VALUE="Submit Answers">
</CENTER>
</FORM>
Tip: Format your poll questions in a graphic editor, then copy
the HTML it creates into the poll format file. |
Step 7: Save the poll format file.
- Save the poll format file and name it "pollformat.txt".
Caution: The format file name must match the
formatFileLocation parameter that is entered in the mgiPoll tag. |
Step 8: Create a poll results page.
- Create a new HTML page to display the poll results. The poll results
will be generated by the mgiPoll tag, but any headers or footers should
be entered on this page. For example, enter a header labelled "Election
Results":
<H2>Election Results</H2>
Step 9: Save the poll results page.
- Save the poll results page and name it "pollresults.html".
Caution: The poll results page name must match
the action parameter of the <FORM> tag that you entered on the poll
format file. |
Step 10: Open the poll results page in a text editor.
- Open the poll results page in a text editing program that allows you
to view and modify HTML.
Step 11: Insert the mgiPoll tag from the mgiPoll page.
- Insert your cursor after the header and enter the mgiPoll tag exactly
as it appears on the poll page that you created previously.This first mgiPoll
tag performs the function of adding poll information to the poll database.
Step 12: Insert a new mgiPoll tag to display results.
- Insert your cursor after the first mgiPoll tag and enter a second mgiPoll
tag with the databaseFileLocation parameter, tableName parameter, formatFileLocation
parameter and tally parameter to display poll results. The values of the
databaseFileLocation, tableName and formatFileLocation parameters should
match those entered on the poll page (e.g., "Surveys", "Election2000"
and "pollformat.txt", respectively). In the tally parameter,
enter the value "Yes" to tally and display results rather than
add new poll information to the poll database:
<mgiPoll databasefilelocation="Surveys" tableName="Election2000"
formatFileLocation="pollformat.txt" tally="Yes">
Step 13: Save the poll results page.
- Save the changes you have made to the poll results page.
Step 14: FTP the poll page and poll results page to the web server running
MGI.
- Upload the poll page, poll format file and poll results page to the
web server using an FTP program.
Step 15: Complete and submit the poll.
- Access the poll page in a web browser. The poll page displays the poll
questions and submit button. Complete the poll and click the "Submit
Answers" button. Your poll information is added to the Surveys database
in the Election2000 table and the current poll results are displayed using
bar graphs and the format of the poll format file.
|