"; $txt=""; $stuname = $_POST["stuname"]; foreach($stuname as $v){ $txt .= $v.","; } echo "學生姓名:$txt
"; ///////////////////////////////// $txt=""; $math = $_POST["math"]; foreach($math as $v){ $txt .= $v.","; } echo "數學成績:$txt
"; ///////////////////////////////// $txt=""; $english = $_POST["english"]; foreach($english as $v){ $txt .= $v.","; } echo "英文成績:$txt
"; ///////////////////////////////// echo "數學平均成績:".array_sum($math)/count($math)."
"; ///////////////////////////////// echo "英文平均成績:".array_sum($english)/count($english)."
"; ///印出表格////////////////////////////// echo ""; while(list($i,$v) = each($stuname)){ if($i%2)$color1="pink"; else $color1="yellow"; echo ""; } echo ""; echo "
姓名數學英文
$v $math[$i] $english[$i]
平均 ".array_sum($math)/count($math)."".array_sum($english)/count($english)."
"; ?>