Show Source Code
<?php
session_start();
$survey_questions = array(1 => "Was the navigation straightforward and did all the links work?",
2 => " Was the selection of background color, font color, and font size appropriate?",
3 => " Were the images appropriate and did they complement the Web content?",
4 => " Were the descriptions of the PHP program complete and easy to understand?",
5 => " Was the PHP code structured properly and well commented?");
$question_count = count($survey_questions);
if (isset($_SESSION['CurrentQuestion'])) {
if (($_SESSION['CurrentQuestion'] > 0) && (isset($_POST['response']))) {
$_SESSION['Responses'][$_SESSION['CurrentQuestion']] = $_POST['response'];
}
++$_SESSION['CurrentQuestion'];
}
else
$_SESSION['CurrentQuestion'] = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"/>
<title>Web Survey</title>
</head>
<body>
<style>
fieldset
{
width: 500px;
margin-left: auto;
margin-right: auto;
background-color: #BCED91;
}
</style>
<?php
include("include/inc_controlstructures.php");
?>
<center><fieldset>
<center><h1><font color="Purple">Web Survey</font></h1></center>
<div>
<?php
if ($_SESSION['CurrentQuestion'] == 0)
{
?>
<p><center>Thank you for reviewing the Chinese Zodiac Web Site. Your candid responses
to the following five questions will help improve the effectiveness of our
PHP demonstration site.</center></p>
<?php
}
else if ($_SESSION['CurrentQuestion'] > $question_count) {
?>
<p><center>Thank you for completing our survey!></center>/p>
<p><a href="index.php?page=inc_state_information">Return to Web Survey Page</a></p>
<?php
}
else {
echo "<p>Question " . $_SESSION['CurrentQuestion'] . ": " . $survey_questions[$_SESSION['CurrentQuestion']] . "</p>\n";
}
if ($_SESSION['CurrentQuestion'] <= $question_count) {
echo "<form method='post' action='myweb_survey.php'>\n";
echo "<input type='hidden' name='PHPSESSID' value='" . session_id() . "' />\n";
if ($_SESSION['CurrentQuestion'] > 0) {
echo "<p><input type='radio' name='response' value='Exceeds Expectations' />Exceeds Expectations<br />\n";
echo "<input type='radio' name='response' value='Meets Expectations' />Meets Expectations<br />\n";
echo "<input type='radio' name='response' value='Below Expectations' />Below Expectations</p>\n";
}
echo "<input type='submit' name='submit' value='";
if ($_SESSION['CurrentQuestion'] == 0)
echo "Start the survey";
else if ($_SESSION['CurrentQuestion'] == $question_count)
echo "Finished";
else
echo "Next Question";
echo "' />\n";
echo "</form>\n";
}
?>
<INPUT Type="button" VALUE="Go Back" onClick="history.go(-2);return true;"></p></FORM>
</fieldset></center>
</body>
</html>