//survey.php
<?
include "common.inc.php";
if(!$Ok)
{
global $PHP_SELF;
$survey_check = "select * from survey where title='$title'";
$check_result = mysql_query($survey_check)
or die("無法進行網上調查。");
$check_num = mysql_num_rows($check_result);
if ($check_num == 0)
{
header("Location: login_error.php?error=沒有找到該調查項目!/n");
}
$check_result = mysql_query($survey_check) ;
$row=mysql_fetch_array($check_result);
$number=$row["totalfield"];
$option1=$row["option1"];
$option2=$row["option2"];
if ($number>2)
{
$option3=$row["option3"];
}
if ($number==4)
$option4=$row["option4"];
$next_action=$PHP_SELF;
$next_action.='?title='.$title;
include "header.inc.php";
include "ad.php";
}
else
$choice_now="choice".$choice;
$new_value=$row[$choice_now] ;
$new_value++;
$SQL="UPDATE survey SET $choice_now='$new_value'
where title='$title'";
mysql_query($SQL) or die(mysql_error());
header("Location: survey_view.php?title=$title");
?>
<body background="images/st.jpg" >
<FORM METHOD="POST" ACTION="<? echo $next_action;?>">
<TABLE width=60% border=0 align=center bgcolor=yellow>
<TR bgcolor=green>
<TD height=20 align=center>
<FONT class=myYellow>
歡迎來到網上調查!
</FONT>
</TD>
</TR>
<TR >
<TD height=50 align=left>
<font size=3 color=blue >
<?
for ($i=1;$i<10;$i++)
echo "&nbsp";
echo $title;?>
</font>
$n=1;
while ($n<=$number)
$option_now="option".$n;
echo "<TR>";
echo "<td width=/"50%/" align=left class=myRed>";
for ($i=1;$i<15;$i++)
echo "&nbsp";
echo "<input type=/"radio/" name=/"choice/" value=".$n;
if ($n==1)
echo " checked";
echo ">";
echo $$option_now;
echo " </td>";
echo " </TR>";
$n++;
<TR>
<INPUT type=submit name=Ok value=" 送出 " class=myBlack>
</TABLE>
</FORM>
<DIV class=myGreen align=center>
<? echo $COPYRIGHT; ?>
</DIV>
</BODY>