第14週 Form-Checkbox<?php $command=$_POST["command"]; if ($command==null) { echo("<html><body><center> <form method=post action=$SELF_PHP> 選項:<br> <input type=checkbox name=choice1[] value=1>choice 1 <br> <input type=checkbox name=choice1[] value=2>choice 2 <br> <input type=checkbox name=choice1[] value=3>choice 3 <br> <input type=checkbox name=choice1[] value=4>choice 4 <br> <input type=checkbox name=choice1[] value=5>choice 5 <br> <input type=submit name=command value=送出> <input type=reset name=command value=清除> </form> </center></body></html>"); } if ($command=="送出") { $choice1=$_POST["choice1"]; $cnt=count($choice1); for ($i=0; $i<$cnt; $i++) { echo "選項:".$choice1[$i]."<br>"; } } ?> 作業 設計滿意度問卷五題 單選 必選 如果未選或選項大於1個 丟出錯誤訊息 例如 1. 對學校的滿意度 非常滿意 滿意 普通 不滿意 非常不滿意
|