想实现在text1.html中选择,然后在text_res.php进行结果统计,并显示出来。小白一个,运行不了,有大神帮忙看下吗?
text1.html代码
<!doctype html>
<html>
<head>
<title>测试1</title>
<script>
function goFunction(){
window.location.href="text_res.php";
}
</script>
</head>
<body>
<form name="text" action="text_res.php" method="post">
<h1>测试1</h1>
<p>1、我觉得闷闷不乐,情绪低沉<br>
<label><input name="sds1" type="radio" value="1">①没有或很少时间</label><br>
<label><input name="sds1" type="radio" value="2">②小部分时间</label><br>
<label><input name="sds1" type="radio" value="3">③相当多时间</label><br>
<label><input name="sds1" type="radio" value="4">④绝大部分或全部时间</label><br></p>
<p>*2、我觉得一天之中早晨最好<br>
<label><input name="sds2" type="radio" value="1">①没有或很少时间</label><br>
<label><input name="sds2" type="radio" value="2">②小部分时间</label><br>
<label><input name="sds2" type="radio" value="3">③相当多时间</label><br>
<label><input name="sds2" type="radio" value="4">④绝大部分或全部时间</label><br></p>
<p>3、我一阵阵哭出来或觉得想哭<br>
<label><input name="sds3" type="radio" value="1">①没有或很少时间</label><br>
<label><input name="sds3" type="radio" value="2">②小部分时间</label><br>
<label><input name="sds3" type="radio" value="3">③相当多时间</label><br>
<label><input name="sds3" type="radio" value="4">④绝大部分或全部时间</label><br></p>
<p><input name="tijiao" type="submit" value="已选好,看看结论!" onclick="goFunction()">
</form>
</body>
</html>
text_res.php代码
<?php
$count0=$_POST['sds1'];
$count1=$_POST['sds1']+$_POST['sds2'];
$count2=$_POST['sds1']+$_POST['sds2']+$_POST['sds3'];
<html>
<head>
<title>结论1</title>
</head>
<body>
<h1>测试1</h1>
echo "一项和为:$count0";
echo "二项和为:$count1";
echo "三项和为:$count2";
</body>
</html>
?>