溫瑞烘老師的教學歷程檔案(Teaching ePortfolio) - 105-2-四技資管二甲乙資料庫管理系統 - 第13週-FORM表單複習
 

資訊管理系
副教授
温瑞烘


歷程檔案 Portfolio


關於我 About Me

第13週-FORM表單複習

//13-1.php
<?php
  $command=$_POST["command"];
  if ($command=="") {
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>班級</td>
          <td align='centger'>
          <select name='depart_class' size='1'>
            <option value=''>請選擇</option>
            <option value='164D21'>四技資管二甲</option>
            <option value='164D22'>四技資管二乙</option>
          </select></td></tr></table>
          <input type='submit' name='command' value='送出'>
          <input type='reset'  name='command' value='重設'>
          </form></body></html>";
  }
  if ($command=="送出") {
    $depart_class=$_POST["depart_class"];
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>班級</td>
          <td align='centger'>
          <select name='depart_class' size='1'>
            <option value=''>請選擇</option>";
    if ($depart_class=="164D21")
      echo "<option value='164D21' selected >四技資管二甲</option>";
    else 
      echo "<option value='164D21' >四技資管二甲</option>";
    if ($depart_class=="164D22")
      echo "<option value='164D22' selected >四技資管二乙</option>";
    else 
      echo "<option value='164D22' >四技資管二乙</option>";
    echo "</select></td></tr></table>
          <input type='submit' name='command' value='送出'>
          </form></body></html>";
  }
?>
 
//13-2.php
<?php
  $command=$_POST["command"];
  if ($command=="") {
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>性別</td>
          <td align='centger'>
          <input type='radio' name='sex' value='1'>男
          <input type='radio' name='sex' value='2'>女
          </td></tr></table>
          <input type='submit' name='command' value='送出'>
          <input type='reset'  name='command' value='重設'>
          </form></body></html>";
  }
  if ($command=="送出") {
    $sex=$_POST["sex"];
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>性別</td>
          <td align='centger'>";
    if ($sex=="1")
      echo "<input type='radio' name='sex' value='1' checked>男";
    else 
      echo "<input type='radio' name='sex' value='1' >男";
    if ($sex=="2")
      echo "<input type='radio' name='sex' value='2' checked>女";
    else 
      echo "<input type='radio' name='sex' value='2' >女";
    echo "</select></td></tr></table>
          <input type='submit' name='command' value='送出'>
          </form></body></html>";
  }
?>
<?php
  $command=$_POST["command"];
  if ($command=="") {
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>性別</td>
          <td align='centger'>
          <input type='radio' name='sex' value='1'>男
          <input type='radio' name='sex' value='2'>女
          </td></tr></table>
          <input type='submit' name='command' value='送出'>
          <input type='reset'  name='command' value='重設'>
          </form></body></html>";
  }
  if ($command=="送出") {
    $sex=$_POST["sex"];
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>性別</td>
          <td align='centger'>";
    if ($sex=="1")
      echo "<input type='radio' name='sex' value='1' checked>男";
    else 
      echo "<input type='radio' name='sex' value='1' >男";
    if ($sex=="2")
      echo "<input type='radio' name='sex' value='2' checked>女";
    else 
      echo "<input type='radio' name='sex' value='2' >女";
    echo "</select></td></tr></table>
          <input type='submit' name='command' value='送出'>
          </form></body></html>";
  }
?>
// 13-3.php
<?php
  $command=$_POST["command"];
  if ($command=="") {
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>姓名</td>
          <td align='centger'>
          <input type='text' name='student_name' >
          </td></tr></table>
          <input type='submit' name='command' value='送出'>
          <input type='reset'  name='command' value='重設'>
          </form></body></html>";
  }
  if ($command=="送出") {
    $student_name=$_POST["student_name"];
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>姓名</td>
          <td align='centger'>
          <input type='text' name='student_name' value='$student_name'>
          </td></tr></table>
          <input type='submit' name='command' value='送出'>
          </form></body></html>";
  }
?>

//13-4.php
<?php
  $command=$_POST["command"];
  if ($command=="") {
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>興趣</td>
          <td align='centger'>
          <input type='checkbox' name='interest[]' value='4' >滿意
          <input type='checkbox' name='interest[]' value='3' >普通
          </td></tr></table>
          <input type='submit' name='command' value='送出'>
          <input type='reset'  name='command' value='重設'>
          </form></body></html>";
  }
  if ($command=="送出") {
    $interest=$_POST["interest"];
    echo "<html><body><center>
          <table width='100%' border='1' bordercolor='black' cellpadding='0' cellspacing='0'>
          <form method='post' action=''>
          <tr><td bgcolor='#ccccff' align='center'>興趣</td>
          <td align='centger'>";
    if ($interest!="" && in_array("4", $interest))
      echo  "<input type='checkbox' name='interest[]' value='4' checked >滿意";
    else
      echo  "<input type='checkbox' name='interest[]' value='4'  >滿意";
    if ($interest!="" && in_array("3", $interest))
      echo  "<input type='checkbox' name='interest[]' value='3' checked >普通";
    else
      echo  "<input type='checkbox' name='interest[]' value='3'  >普通";
    echo "</td></tr></table>
          <input type='submit' name='command' value='送出'>
          </form></body></html>";
  }
?>
 
複習題:第一個頁面有
班級:下拉選單 (select 四技資管三甲、四技資管三乙、四技資管三丙)
性別:radio
姓名:text
興趣(checkbox):多重選擇(至少5種)
送出之後第二個頁面維持原來的輸入
並有一個送出按鍵 
 
全部共 0則留言
登入帳號密碼代表遵守學術網路規範
 


文章分類 Labels

 


最新文章 Top10

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