<?php require_once('../../Connections/WWF.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO planktonnew (phytoplankton1, phytoplankton2, phytoplankton3, phytoplankton4, phytoplankton5, phytoplankton6, phytoplankton7, plankton1, plankton2, plankton3, plankton4, plankton5, plankton6, plankton7, plankton8) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString(isset($_POST['phytoplankton1']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton2']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton3']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton4']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton5']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton6']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['phytoplankton7']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton1']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton2']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton3']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton4']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton5']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton6']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton7']) ? "true" : "", "defined","1","0"),
                       GetSQLValueString(isset($_POST['plankton8']) ? "true" : "", "defined","1","0"));

  mysql_select_db($database_WWF, $WWF);
  $Result1 = mysql_query($insertSQL, $WWF) or die(mysql_error());
}

mysql_select_db($database_WWF, $WWF);
$query_planktonresult = "SELECT * FROM planktonnew";
$planktonresult = mysql_query($query_planktonresult, $WWF) or die(mysql_error());
$row_planktonresult = mysql_fetch_assoc($planktonresult);
$totalRows_planktonresult = mysql_num_rows($planktonresult);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>浮游生物多面睇</title>
<style type="text/css">
<!--
body {
	background-color: #FFFFCC;
	text-align: center;
}
.style2 {
	color: #006600;
	font-weight: bold;
	font-size: 16px;
}
.style8 {
	color: #006600;
	font-weight: bold;
	font-size: 14pt;
	font-family: "新細明體";
}
.style12 {
	color: #006600;
	font-size: 12pt;
	text-align: center;
}
.style13 {	font-size: 12pt;
	font-weight: bold;
	color: #006600;
}
.style15 {
	font-size: 12pt;
	color: #003300;
}
.af {
	text-align: center;
}
.k {
	text-align: center;
}
-->
</style></head>

<body>
<div align="center">
  <p><img src="plankton_s.jpg" width="228" height="113" /></p>
  <table width="800" border="1">
    <tr>
      <td colspan="2" bgcolor="#F0FFF8"><div align="center" class="style13">任務</div></td>
    </tr>
    <tr>
      <td width="86" bgcolor="#F0FFF8"><span class="style12">任務一</span></td>
      <td width="698" bgcolor="#F0FFF8"><div align="left"><span class="style12">每組利用提供的浮遊生物網，收集水中的浮游生物樣本。</span></div></td>
    </tr>
    <tr>
      <td bgcolor="#F0FFF8"><span class="style12">任務二</span></td>
      <td bgcolor="#F0FFF8"><div align="left"><span class="style12">利用顯微鏡觀察及拍攝浮游生物。</span></div></td>
    </tr>
  </table>
  <br />
  <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
    <table width="901" border="1">
      <tr>
        <td colspan="4" bgcolor="#DFFFEF"><div align="center" class="style2">1)浮游植物</div></td>
      </tr>
      <tr>
        <td width="216" align="center" bgcolor="#DFFFEF"><div align="center">
          <p><img src="Plankton_new/phytoplankton1.jpg" width="214" height="156" border="0" /><span class="style12"><br />
            角藻 </span>
            <label>
              <input name="phytoplankton1" type="checkbox" id="phytoplankton1" value="1" />
              </label>
            </p>
          </div></td>
        <td width="220" align="center" bgcolor="#DFFFEF"><div align="center"><img src="Plankton_new/phytoplankton2.jpg" width="199" height="164" border="0" /><br />
          <span class="style12">角藻</span>
          <label>
            <input name="phytoplankton2" type="checkbox" id="phytoplankton2" value="1" />
            </label>
          <br />
          </div></td>
        <td width="220" align="center" bgcolor="#DFFFEF"><div align="center"><img src="Plankton_new/phytoplankton3.jpg" width="199" height="165" border="0" /><br />
          <span class="style12">夜光藻 </span>
          <label>
            <input name="phytoplankton3" type="checkbox" id="phytoplankton3" value="1" />
            </label>
          </div></td>
        <td width="221" align="center" bgcolor="#DFFFEF"><img src="Plankton_new/phytoplankton4.jpg" width="196" height="162" border="0" /><span class="style12"><br />
          根管藻</span>
          <label>
            <input name="phytoplankton4" type="checkbox" id="phytoplankton4" value="1" />
          </label>
          <br /></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#DFFFEF"><div align="center"><span class="style12"><img src="Plankton_new/phytoplankton5.jpg" width="216" height="161" border="0" /><br />
          </a>盒形藻</span>
          <label>
            <input name="phytoplankton5" type="checkbox" id="phytoplankton5" value="1" />
            </label>
          <br />
          </div></td>
        <td align="center" bgcolor="#DFFFEF"><div align="center"><span class="style12"><img src="Plankton_new/phytoplankton6.jpg" width="204" height="168" border="0" /><br />
          </a>圓篩藻</span>
          <label>
            <input name="phytoplankton6" type="checkbox" id="phytoplankton6" value="1" />
            </label>
          <br />
          </div></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/phytoplankton7.jpg" width="208" height="172" border="0" /><br />
          </a>彎角藻</span></span>
          <label>
            <input name="phytoplankton7" type="checkbox" id="phytoplankton7" value="1" />
          </label>
          <br />
          &nbsp;</td>
        <td align="center" bgcolor="#DFFFEF">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4" bgcolor="#DFFFEF"><div align="center" class="style8">2)浮游動物</div></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#DFFFEF"><p><span class="style12"><img src="Plankton_new/plankton1.jpg" width="209" height="162" /><br />
          水母幼體
          <label>
            <input name="plankton1" type="checkbox" id="plankton1" value="1" />
            </label>
          <br />
          </span></p></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton2.jpg" width="213" height="164" /><br />
          水蚤
          <input name="plankton2" type="checkbox" id="plankton2" value="1" />
          </span></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton3.jpg" width="205" height="163" /><br />
          多毛蟲綱
          <input name="plankton3" type="checkbox" id="plankton3" value="1" />
          </span></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton4.jpg" width="209" height="164" /><br />
          放射蟲
          <input name="plankton4" type="checkbox" id="plankton4" value="1" />
          </span></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton5.jpg" width="213" height="165" /><br />
          橈足亞綱
          <input name="plankton5" type="checkbox" id="plankton5" value="1" />
          </span></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton6.jpg" width="220" height="158" /><br />
          橈足亞綱
          <input name="plankton6" type="checkbox" id="plankton6" value="1" />
          </span></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton7.jpg" width="220" height="183" /><br />
          雙殼綱
          <input name="plankton7" type="checkbox" id="plankton7" value="1" />
          </span></td>
        <td align="center" bgcolor="#DFFFEF"><span class="style12"><img src="Plankton_new/plankton8.jpg" width="221" height="147" /><br />
          纖毛蟲
          <input name="plankton8" type="checkbox" id="plankton8" value="1" />
          </span></td>
      </tr>
    </table>
    <p>
      <label>
        <input type="submit" name="save" id="save" value="儲存" />
      </label>
      <input type="hidden" name="MM_insert" value="form1" />
  </p>
  </form>
  <p><a href="planktonresult-new.php">
  <?php if ($totalRows_planktonresult > 0) { // Show if recordset not empty ?>
    <img src="planktonresult.jpg" width="230" height="95" border="0" />
    <?php } // Show if recordset not empty ?>
  </a><br />
    <br />
  <a href="activity.html"><img src="back to activity.jpg" width="172" height="56" border="0" /></a></p>
  <p><a href="map.html"><img src="main.jpg" width="172" height="56" border="0" /></a></p>
  <p>Photos copyright (c) WWF-Hong Kong</p>
</div>
</body>
</html>
<?php
mysql_free_result($planktonresult);
?>
