0

我正在使用 php myadmin 进行一个简单的调查,以便稍后分析数据。我运行这段代码,我只是得到一个空白页。问题和解决方案可能是什么?我一直盯着这段代码好几个小时了,还没有解决方案。赛安普

<?php
$init_connection = mysql_connect("localdev1.local","user","123" );
mysql_select_db("Word Think",$init_connection);

function displaySurvey ($prompt, $questions){
echo "<td><b>".$prompt."</b><form method=\"post\" action=\"\">"
    "<table border=\"0\"/>"

for(i = 0; $i <count($questions) ;$i++){
    echo "<tr><td><label><input type=\"radio\" name+\survey\" value=\"".i."\"/>".
$questions[$i]."</label></td></tr>"; 
}

echo "</table>"
<input type=\"submit\" name=\"submit" value=\"Select Appropriate Response\" /> 
</form></td></td></table>";
}
$answer_1 = "*SELECT * FROM poll WHERE id = 1";
$process_one = mysql_query($answer_1);
while($row = mysql_fetch_array($process_one, MYSQL_ASSOC)){
$mod_c_one = (int)$row['c_one'] + 1;
$mod_c_two = (int)$row['c_two'] + 1;
$mod_c_three = (int)$row['c_three'] + 1;
$mod_c_four = (int)$row['c_four'] + 1;
}
$choices = array('Definately Yes', 'Yes', 'Undecided', 'No', 'Definately No' );
echo "<table><tr><td><b>Results;</b><table><tr><td>".(mod_c_1-1)."</td><td>".
$choices[0]."<td></tr><tr><td>".($mod_c_2-1)."</td><td>".$choices[1]."</td></tr><tr><td>".
($mod_c_3-1)."</td><td>".$choices[2]."</td></tr><tr><td>".($mod_c_4-1)."</td>          <td>".$choices[3]."</td></tr></table></td>";
displaySurvey('Would Your Recomend Your Current Employer', $choices);
if(isset($_POST['sumbit'])){
if(isset($_POST['survey']))
    $selection = $_POST['survey'];
else
    $selection = "";

if(strlen($selection) > 0){
    switch((int)$selection){
        case 0:
            $select_stmt = "UPDATE survey SET c_1 = $mod_c_1 WHERE id =     1";
        case 1:
            $select_stmt = "UPDATE survey SET c_2 = $mod_c_2 WHERE id = 1";
        case 2:
            $select_stmt = "UPDATE survey SET c_3 = $mod_c_3 WHERE id = 1";
        case 3:
            $select_stmt = "UPDATE survey SET c_4 = $mod_c_4 WHERE id = 1";
    }

    $process = myswq_query($select_stmt)or die(mysql_error());
    if($process)
        echo "Thank you for participating";
    else
        echo "Error";

    echo $chocies[$selection];
    }else
        echo "You have not selected a response yet";
}

?>  
4

1 回答 1

0

PHP 文件中的空白可能会引起一些真正的麻烦(通常以空白页的形式)。您似乎在结束?>标记后有两个空格。尝试删除它们,看看会发生什么。

于 2012-12-30T07:14:27.340 回答