<?PHP

if (eregi("include_survey.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php"); die();
}

$questionList = mysql_query("SELECT * FROM gforum_SurveyQuestion WHERE Survey_ID_FK = 1 ORDER BY Question_ID;");

echo ("<form name='2008survey' method='post' action='index.php' >"); //onSubmit=\"return confirm('Are you ready to submit your answers?');\"

while($question = mysql_fetch_array($questionList)) {
  echo ("<div class='question' style='clear: both; margin: 15px 0px 15px 0px;'>\n");
  echo ("<span class='question_topic' style='font-weight: bold'>".$question['Question_Name'].": </span><br />\n");
  echo("<span class='question_subtitle' style='font-style: italic'>".$question['Question_Description']."</span><br />\n");
  $answerList = mysql_query("SELECT * FROM gforum_SurveyAnswer WHERE Question_ID_FK = ". $question['Question_ID']." ORDER BY Answer_Name;");
  while($answer = mysql_fetch_array($answerList)) {
    $temp = "qid".$question['Question_ID'];
    $selected = "";
    if ($answer['Answer_ID'] == $_POST[$temp]) { $selected = "checked"; }
  	echo ("<input type='radio' name='qid".$question['Question_ID']."' value='".$answer['Answer_ID']."' ".$selected.">".$answer['Answer_Name']."<br />\n");
  }
  //echo ("<input type='radio' name='".$question['Question_ID']."' value='0'>No Vote<br />");
  echo ("</div>\n");
}

$ip = $_SERVER['REMOTE_ADDR'];
echo ("<input type=\"hidden\" name=\"uid\" value=\"$useruid\" >\n");
echo ("<input type=\"hidden\" name=\"ip\" value=\"$ip\" >\n");

echo ("<input type=\"submit\" name=\"Submit\" value=\"SUBMIT\" class='nobutton'><br /><br /><input type=\"reset\" name=\"Reset\" value=\"RESET\" class='nobutton'>");
echo ("</form>");

?> 