溫瑞烘老師的教學歷程檔案(Teaching ePortfolio) - 100-1 資管三乙三丙教學資源區 - 第10週 checkbox 與 select
 

資訊管理系
副教授
温瑞烘


歷程檔案 Portfolio


關於我 About Me

第10週 checkbox 與 select

<?php
 $command=$_POST["command"];
 if ($command==null)
  {
   echo("<html>
         <body>
         <center>
         <form method=post action=$SELF_PHP>
         選項:
         <p>
         <input type=checkbox name=choice[] value=1>choice 1
         <p>
         <input type=checkbox name=choice[] value=2>choice 2
         <p>
         <input type=checkbox name=choice[] value=3>choice 3
         <p>
         <input type=checkbox name=choice[] value=4>choice 4
         <p>
         <input type=checkbox name=choice[] value=5>choice 5
         <p>
        <input type=submit name=command value=送出>
        <input type=reset  name=command value=清除>
        </form>
        </center>
        </body>
        </html>");
  }
if ($command=="送出")
 {
  $choice=$_POST["choice"];
  foreach ($choice as $number) $result=$result.$number;
  echo("<html>
        <body>
        <center>
        選項:$result
        <p>
        </center>
        </body>
        </html>");
 }
?>







<?php
 $command=$_POST["command"];
 if ($command==null)
  {
   echo("<html>
         <body>
         <center>
         <form method=post action=$SELF_PHP>
         月
         <select name=month size=1>
        ");
   for ($i=1; $i<=12; $i++)
     echo("<option value=$i>$i </option>");
   echo("</select> <p>
         日
         <select name=day size=1>
        ");
   for ($i=1; $i<=31; $i++)
     echo("<option value=$i>$i </option>");
   echo("</select> <p>");
   echo("<input type=submit name=command value=送出>
         <input type=reset  name=command value=清除>
         </form>
         </center>
         </body>
         </html>");
  }
if ($command=="送出")
 {
  $month=$_POST["month"];
  $day=$_POST["day"];
  echo("<html>
        <body>
        <center>
        $month 月 $day 日
        <p>
        </center>
        </body>
        </html>");
 }
?>



作業:  寫一程式 第一個頁面顯示登入頁面(帳號密碼), 以學號為帳號密碼,登入成功後顯示第二頁面
利用兩種 標簽 checkbox 與 select, checkbox可以多重選擇各人嗜好(至少列出5種)
select 可以選擇出生年  月  日 
第三個頁面顯示結果

 

全部共 0則留言
登入帳號密碼代表遵守學術網路規範
 


文章分類 Labels

 


最新文章 Top10

中華科技大學數位化學習歷程 - 意見反應