<?
session_start();
ob_start();
?>
<!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=utf-8" />
<title>Fish landing data management system</title>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"inputField",
			dateFormat:"%Y-%m-%d",
			limitToToday:true
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
		new JsDatePick({
			useMode:2,
			target:"inputField2",
			dateFormat:"%Y-%m-%d"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
	};
</script>

<script type="text/javascript">
function onInsert()
{ 
		if(form1.txtvesselname.value =="")
		{
			alert("You not fill vessel name!");
			form1.txtvesselname.focus();
			return false;
		}
		else
		{
			return true; 
		}	 
} 

function onUpdate() 
{ 
		if(form2.txtvesselname2.value =="")
		{
			alert("You not fill vessel name!");
			form2.txtvesselname2.focus();
			return false;
		}
		else
		{
			return true;
		} 
} 
</script>
<style type="text/css">
<!--
#wrapper {
		border: 1px solid black;
		background-color: #E0E0EF;
		color:#FFFFFF;
		padding:10px;
        height:800px;
        width:1024px;
		text-align:center;
    }
.stylewhite {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
}
.stylewhitesmall {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
.stylegreen {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #00661F;
}
.styleblack {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #000000;
}
.styleblacklarge {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: #000000;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	color: #FFFFFF;
	text-decoration: none;
}
a:hover {
	color: #FF0000;
	text-decoration: none;
}
a:active {
	color: #FFFFFF;
	text-decoration: none;
}
.style1 {color: #FF0000}
.styleblacklargered {	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
	color:#FF0000;
}
.styletextbox {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color:#000000; }

-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->


<table width="1024" height="799" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3" id="Table_01">
<tr>
		<td height="50" colspan="2" bgcolor="#ADCE4C" class="stylewhite">&nbsp;Fish Landing Data Management System	    </td>
  </tr>
	<tr class="stylewhitesmall">
	  <td height="20" colspan="2" bgcolor="#006666"><span class="styleblack">&nbsp;</span><span class="styleblack">&nbsp;</span><a href="main.php">Home</a><span class="style1">&nbsp;</span> | <a href="usr.php">User</a> |<span class="style1"> <a href="fishingzone.php">Fishing Area |</a> <a href="district.php">State/Province </a></span>|<a href="samplingport.php"> Landing Site </a>| <a href="fgmethod.php">Fishing Gear and Method</a> | <a href="vessel.php">Fishing Vessel</a> | <a href="species.php">Fish Species</a> | <a href="catchdata.php">Catch Data </a> | <a href="biology.php">Biology Data</a> | <a href="report.php"> </a><a href="report.php">Report</a> |<span class="style1"> <a href="logout.php">Logout</a></span>
	    <div align="right"></div></td></tr>
	<tr>
	  <td width="246" height="705" valign="top" bgcolor="#CCCCCC">
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
<tr>
            <td width="60%" bgcolor="#000000"><div align="center">
              <span class="stylewhitesmall">
          <?
if($_POST[submit])
{
		//ShipId,ShipName,Owner,ShipLength,ShipType,EngineType,EngineHP, ShipWidth,ShipDepth,GrossTon,TypeofHull,DateBuild,PlaceBuilt,Nationality,NumberofCrew, OwnerAddress,OwnerContactNumber,email,District,GearType,NetLength,NetWidth,MeshSize,NoHook,PicShip
		include "usr_function.php";
		$insshipname = trim($_POST["txtvesselname"]);
		$insshipid = trim($_POST["txtregisno"]);
		$insowner = trim($_POST["txtname"]);
		$insshiplength = chknull(trim($_POST["txtlength"]));
		$insenginetype = trim($_POST["txtenginetype"]);
		$inshoursepower = chknull(trim($_POST["txthoursepower"]));
		$insshipwidth = chknull(trim($_POST["txtwidth"]));
		$insshipdepth = chknull(trim($_POST["txtdepth"]));
		$insgrosston = chknull(trim($_POST["txtgrosston"]));
		$inshull = trim($_POST["txthull"]);
		$insdatebuild = chknull(trim($_POST["inputField"]));
		$insplacebuild = trim($_POST["txtplacebuild"]);
		$insnatinality = trim($_POST["txtnationality"]);
		$inscrew = chknull(trim($_POST["txtnoofcrew"]));	
		$insaddress = trim($_POST["txtaddress"]);
		$insdistrict = trim($_POST["txtdistrict"]);
		$inscontact = trim($_POST["txtcontactno"]);
		$insemail = trim($_POST["txtemail"]);
		//gear
		$instypeofgear = chknull($_POST["txttypeofgear"]);
		$insnetlength = chknull(trim($_POST["txtnetlength"]));
		$insnetwidth = chknull(trim($_POST["txtnetwidth"]));
		$insmeshsize = chknull(trim($_POST["txtmeshsize"]));
		$insnohook = chknull(trim($_POST["txthook"]));
		
		$inssector = $_POST["lstsector"];
		$insgearlicence = trim($_POST["txtlicenceno"]);
		$insexpiredate = chknull(trim($_POST["inputField2"]));
		//$inszone = $_POST["lstzone"];
		$inshooksize = chknull(trim($_POST["txthooksize"]));
		$insnounit = chknull(trim($_POST["txtunit"]));
		
	require_once("vessel_function.inc.php");
	InsertVessel($insshipid,$insshipname,$insowner,$insshiplength,$insenginetype,$inshoursepower,$insshipwidth,$insshipdepth,$insgrosston,$inshull,$insdatebuild,$insplacebuild,$insnatinality,$inscrew,$insaddress,$inscontact,$insemail,$insdistrict,$instypeofgear,$insnetlength,$insnetwidth,$insmeshsize,$insnohook,$inssector,$insgearlicence,$insexpiredate,$inshooksize,$insnounit);
					//$fishsector,$gearlicence,$expiredate,$zoneid,$hooksize,nounit
					if($_FILES["fileField2"]["name"] != "")
						{
						  	if(($_FILES["fileField2"]["type"] == "image/gif")|| ($_FILES["fileField2"]["type"] == "image/pjpeg") && ($_FILES["fileField2"]["size"] < 20000))
							{
							
						  		require("usr_function.php");
								$msg = $_FILES["fileField2"]["type"]."File type: JPG or GIF only";
								ErrMsg($msg);
						  	}
						  	else
						  	{		
								//echo "file type=".$_FILES["fileField2"]["type"];
								
								if($_FILES["fileField2"]["type"] == "image/gif")
								{
								$dnow = date("YmdHis");
								//echo "d now=".$dnow;
								$newname = $dnow.".gif";
								}
								elseif($_FILES["fileField2"]["type"] == "image/pjpeg" || $_FILES["fileField2"]["type"] == "image/jpeg")
								{
								$dnow = date("YmdHis");
								//echo "d now=".$dnow;
								$newname = $dnow.".jpg";
								}
								//echo $newname;
								//$fname = rename($_FILES["file"]["name"],$newname);
								//Create Folder--------------------------
								if (!file_exists("ship/"))
								{
									mkdir("ship/");
								} 
								//---------------------------------------

								$save_file = "ship/".$newname;
								//echo "New Name=".$newname;
								require_once("vessel_function.inc.php");
								$sname = trim($_POST["txtvesselname"]);
								InsertVesselPic($sname,$newname);
								$tlog = "Add Vessel File ".$newname."(".$sname.")";
								//require_once("usr_function.php");
								addLog($_SESSION['myusername'],$tlog);
						
								if(!copy($_FILES["fileField2"]["tmp_name"],$save_file))
								{
								echo "Upload: " . $_FILES["fileField2"]["name"] . "<br>";
    							echo "Type: " . $_FILES["fileField2"]["type"] . "<br>";
    							echo "Size: " . ($_FILES["fileField2"]["size"] / 1024) . " Kb<br>";
    							echo "Temp file: " . $_FILES["fileField2"]["tmp_name"] . "<br>";
				  				}
							}
						}
	
	$tlog = "Add Vessel ".$insshipname;
	//require_once("usr_function.php");
	addLog($_SESSION['myusername'],$tlog);
}
if($_POST[submit2])
{
		include "usr_function.php";
		$edtoldshipname = $_POST["hdpid2"];
		$edtshipname = trim($_POST["txtvesselname2"]);
		$edtshipid = trim($_POST["txtregisno2"]);
		$edtowner = trim($_POST["txtname2"]);
		$edtshiplength = chknull(trim($_POST["txtlength2"]));
		$edtenginetype = trim($_POST["txtenginetype2"]);
		$edthoursepower = chknull(trim($_POST["txthoursepower2"]));
		$edtshipwidth = chknull(trim($_POST["txtwidth2"]));
		$edtshipdepth = chknull(trim($_POST["txtdepth2"]));
		$edtgrosston = chknull(trim($_POST["txtgrosston2"]));
		$edthull = trim($_POST["txthull2"]);
		//echo "chkbox2=".$_POST[checkbox2];
		if($_POST[checkbox2]!=1)
		{
		$edtdatebuild = $_POST["datebuild2"];
		}
		else
		{
		$edtdatebuild = "";
		}
		$edtplacebuild = trim($_POST["txtplacebuild2"]);
		$edtnatinality = trim($_POST["txtnationality2"]);
		$edtcrew = chknull(trim($_POST["txtnoofcrew2"]));	
		$edtaddress = trim($_POST["txtaddress2"]);
		$edtdistrict = trim($_POST["txtdistrict2"]);
		$edtcontact = trim($_POST["txtcontactno2"]);
		$edtemail = trim($_POST["txtemail2"]);
		//gear
		$edttypeofgear = trim($_POST["txttypeofgear2"]);
		$edtnetlength = chknull(trim($_POST["txtnetlength2"]));
		$edtnetwidth = chknull(trim($_POST["txtnetwidth2"]));
		$edtmeshsize = chknull(trim($_POST["txtmeshsize2"]));
		$edtnohook = chknull(trim($_POST["txthook2"]));
		
		$edtsector = $_POST["lstsector2"];
		$edtgearlicence = trim($_POST["txtlicenceno2"]);
		$edtexpiredate = $_POST["expiringdate2"];
		//$edtzone = $_POST["lstzone2"];
		$edthooksize = chknull(trim($_POST["txthooksize2"]));
		$edtnounit = chknull(trim($_POST["txtunit2"]));
		
	
	require_once("vessel_function.inc.php");
	//EditVessel($shipid,$shipname,$newshipname,$owner,$shiplength,$enginetype,$enginehp,$shipwidth,$shipdepth,$grosston,$typeofhull,$datebuild,$placebuilt,$nationality,$numberofcrew,$owneraddress,$ownercontactnumber,$email,$district,$geartype,$netlength,$netwidth,$meshsize,$nohook,$fishsector,$gearlicence,$expiredate,$hooksize,$nounit)
	EditVessel($edtshipid,$edtoldshipname,$edtshipname,$edtowner,$edtshiplength,$edtenginetype,$edthoursepower,$edtshipwidth,$edtshipdepth,$edtgrosston,$edthull,$edtdatebuild,$edtplacebuild,$edtnatinality,$edtcrew,$edtaddress,$edtcontact,$edtemail,$edtdistrict,$edttypeofgear,$edtnetlength,$edtnetwidth,$edtmeshsize,$edtnohook,$edtsector,$edtgearlicence,$edtexpiredate,$edthooksize,$edtnounit);
	$tlog = "Edit Vessel ".$edtshipname;
	//require_once("usr_function.php");
	addLog($_SESSION['myusername'],$tlog);
	
					$edtshipname = trim($_POST["txtvesselname2"]);
					$encodeship = base64_encode($edtshipname);
					if($_FILES["fileField"]["name"] != "")
						{
						require_once("vessel_function.inc.php");
						DeleteVesselFile($edtshipname);
						if(($_FILES["fileField"]["type"] != "image/gif") && ($_FILES["fileField"]["type"] != "image/pjpeg") && $_FILES["fileField"]["type"] != "image/jpeg")
							{
						  		//require("usr_function.php");
								$msg = $_FILES["fileField"]["type"]."File type: JPG or GIF only";
								ErrMsg($msg);
						  	}
						  	else
						  	{			
								if($_FILES["fileField"]["type"] == "image/gif")
								{
								$dnow = date("YmdHis");
								$newname = $dnow.".gif";
								}
								elseif($_FILES["fileField"]["type"] == "image/pjpeg" || $_FILES["fileField"]["type"] == "image/jpeg")
								{
								$dnow = date("YmdHis");
								$newname = $dnow.".jpg";
								}
								//echo $newname;
								//$fname = rename($_FILES["file"]["name"],$newname);
								//Create Folder--------------------------
								if (!file_exists("ship/"))
								{
									mkdir("ship/");
								} 
								//---------------------------------------

								$save_file = "ship/".$newname;
								require_once("vessel_function.inc.php");
								$sname = trim($_POST["txtvesselname2"]);
								InsertVesselPic($sname,$newname);
								$tlog = "Edit Vessel File ".$newname."(".$sname.")";
								//require_once("usr_function.php");
								addLog($_SESSION['myusername'],$tlog);
								
								if(!copy($_FILES["fileField"]["tmp_name"],$save_file))
																
								{
								echo "Upload: " . $_FILES["fileField"]["name"] . "<br>";
    							echo "Type: " . $_FILES["fileField"]["type"] . "<br>";
    							echo "Size: " . ($_FILES["fileField"]["size"] / 1024) . " Kb<br>";
    							echo "Temp file: " . $_FILES["fileField"]["tmp_name"] . "<br>";
				  				}
							}
						}
							
		
}
if($_POST[submit3])
{
	$delid = $_POST["hdpid3"];
	require_once("vessel_function.inc.php");
	DeleteVessel($delid);
	$tlog = "Delete Vessel ".$delid;
	require_once("usr_function.php");
	addLog($_SESSION['myusername'],$tlog);
}
if($_POST[delimg])
{

	$edtshipname = trim($_POST["txtvesselname2"]);
	require_once("vessel_function.inc.php");
	DeleteVesselFile($edtshipname);
	//$encodeship = base64_encode($edtshipname);
	//header("vessel.php?edtship=$encodeship");
}				
?>
          Fishing Vessel</span></div></td>
          <td width="18%" bgcolor="#000000" class="stylewhitesmall"><div align="center">Edit</div></td>
            <td width="22%" bgcolor="#000000" class="stylewhitesmall"><div align="center">Delete</div></td>
        </tr>
          <div align="center"> <span class="stylegreen">
            <?
	  include "connect.inc.php";
	  $sqlgetship = "SELECT ShipId,ShipName  FROM ship order by ShipName";
	  //echo $sqlgetship;
	  $qrygetship = mysql_query($sqlgetship);
	  $numgetship = mysql_num_rows($qrygetship);
	   for($i=1;$i<=$numgetship;$i++)
		{
			$resgetship = mysql_fetch_array($qrygetship);
			$dbshipid = $resgetship["ShipId"];
			$dbshipname = $resgetship["ShipName"];
			
			$encodeship = base64_encode($dbshipname);
			?>
            </span>
              <tr class="styleblack">
                <td bgcolor="#006666"><span class="stylewhitesmall"><? echo $dbshipname;?></span></td>
                <td align="center" bgcolor="#006666"><a href="vessel.php?edtship=<? echo $encodeship; ?>"><img src="images/document_edit.png" width="20" height="20" border="0"></a></td>
                <td align="center" bgcolor="#006666"><a href="vessel.php?delship=<? echo $encodeship; ?>"> <img src="images/close.png" width="20" height="20" border="0"></a></td>
              </tr>
              <span class="stylegreen">
              <?
        }
      ?>
            </span></div>
	      <tr>
            <td colspan="3" bgcolor="#000000"><div align="right"><span class="stylewhitesmall"><a href="vessel.php"><img src="images/add.png" width="24" height="24" border="0"></a></span><span class="styleblack">&nbsp;&nbsp; </span></div></td>
        </tr>
      </table>	    </td>
      <td width="772" height="705" valign="top" bgcolor="#CCCCCC"><?
	  if(!isset($_GET["edtship"]) && !isset($_GET["delship"]))
	  {
	  ?><br>
        <form action="vessel.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="return onInsert();">
          <table width="98%" height="200" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="19" colspan="4" background="images/index_01.gif"><div align="center"><span class="stylewhite">Add Vessel</span></div>
                  <div align="right"></div></td>
            </tr>
            <tr>
              <td height="14" colspan="4" bgcolor="#ADCE4C" class="style1"><label></label></td>
            </tr>

            <tr>
              <td width="19%" height="12" valign="top" bgcolor="#ADCE4C" class="style1"><div align="left"><span class="stylegreen">&nbsp;Vessel Name</span>&nbsp; </div></td>
              <td width="32%" height="12" bgcolor="#ADCE4C"><label>
                <input name="txtvesselname" type="text" class="styleblack" id="txtvesselname" maxlength="20">
              </label></td>
              <td colspan="2" bgcolor="#6B716F" class="stylewhitesmall">&nbsp;Fishing gear description</td>
            </tr>
            <tr>
              <td height="3" valign="top" bgcolor="#ADCE4C" class="style1"><div align="left"><span class="stylegreen">&nbsp;Registration no.</span>&nbsp; </div></td>
              <td height="3" bgcolor="#ADCE4C"><input name="txtregisno" type="text" class="styleblack" id="txtregisno" maxlength="20"></td>
              <td width="23%" height="3" bgcolor="#ADCE4C" class="stylegreen">Type of gear</td>
              <td width="26%" height="3" bgcolor="#ADCE4C"><span class="styletextbox">
                <select name="txttypeofgear" class="styleblack" id="txttypeofgear">
                  <?php
		 $sqlgetgear = "select fgid,fishinggear from gearandmethod order by fgid";
	  
	  $qrygetgear = mysql_query($sqlgetgear);
	  $numgetgear = mysql_num_rows($qrygetgear);
	   for($i=1;$i<=$numgetgear;$i++)
		{
			$resgetgear = mysql_fetch_array($qrygetgear);
			$dbfgid = $resgetgear["fgid"];
			$dbgear = $resgetgear["fishinggear"];
			echo "<option value='$dbfgid'>$dbgear</option>";
			  }
			  ?>
                </select>
              </span></td>
            </tr>
            <tr>
              <td height="3" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Type of Fishing Sector&nbsp; </div></td>
              <td height="3" bgcolor="#ADCE4C"><span class="styletextbox">
                <select name="lstsector" class="styleblack" id="lstsector">
                  <?php
		 $sqlgetgeart = "SELECT shptid,manpower,sector FROM shiptype inner join fishingsector on fishingsector.sid = shiptype.sid";
	  	$qrygetgeart = mysql_query($sqlgetgeart);
	  	$numgetgeart = mysql_num_rows($qrygetgeart);
	   for($gt=1;$gt<=$numgetgeart;$gt++)
		{
			$resgetgeart = mysql_fetch_array($qrygetgeart);
			$dbfgtid = $resgetgeart["shptid"];
			$dbmanpower = $resgetgeart["manpower"];
			$dbsector = $resgetgeart["sector"];
			$fsector = $dbsector;
			//$fsector = $dbsector." (".$dbmanpower.")";
			echo "<option value='$dbfgtid'>$fsector</option>";
			  }
			  ?>
              </select>
              </span></td>
              <td width="23%" height="3" bgcolor="#ADCE4C" class="stylegreen">Fishing gear license no.</td>
              <td width="26%" height="3" bgcolor="#ADCE4C"><input name="txtlicenceno" type="text" id="txtlicenceno" size="10" maxlength="10" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57)" ></td>
            </tr>
            <tr>
              <td height="7" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Length (meter)&nbsp; </div></td>
              <td height="7" bgcolor="#ADCE4C"><input name="txtlength" type="text" class="styleblack" id="txtlength" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10"></td>
              <td height="7" bgcolor="#ADCE4C" class="stylegreen">Expiring date</td>
              <td height="7" bgcolor="#ADCE4C" class="styleblack"><input name="inputField2" type="text" class="styleblack" id="inputField2" size="12" />
              </td>
            </tr>
            <tr>
              <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Width (meter)&nbsp; </div></td>
              <td height="13" bgcolor="#ADCE4C"><input name="txtwidth" type="text" class="styleblack" id="txtwidth" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10"></td>
              <td height="13" bgcolor="#ADCE4C" class="stylegreen">Net Length (meter) </td>
              <td height="13" bgcolor="#ADCE4C"><span class="styletextbox">
                <input name="txtnetlength" type="text" class="styleblack" id="txtnetlength3" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10" />
              </span></td>
            </tr>
            <tr>
              <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Depth (meter)&nbsp; </div></td>
              <td height="13" bgcolor="#ADCE4C"><input name="txtdepth" type="text" class="styleblack" id="txtdepth" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10"></td>
              <td height="13" bgcolor="#ADCE4C" class="stylegreen">Net Width(meter)</td>
              <td height="13" bgcolor="#ADCE4C"><input name="txtnetwidth" type="text" class="styleblack" id="txtnetwidth" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10" /></td>
            </tr>
            <tr>
              <td height="6" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Engine type&nbsp; </div></td>
              <td height="6" bgcolor="#ADCE4C"><span class="styleblack">
              <select name="txtenginetype" class="styleblack" id="txtenginetype">
               <option value=""></option>
  <option value="Diesel">Diesel</option>
  <option value="Petrol">Petrol</option>
</select>
              </span></td>
              <td height="6" bgcolor="#ADCE4C" class="stylegreen">Mesh size(mm)</td>
              <td height="6" bgcolor="#ADCE4C"><input name="txtmeshsize" type="text" class="styleblack" id="txtmeshsize" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10" /></td>
            </tr>
            <tr>
              <td height="7" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Horse power(hp)&nbsp; </div></td>
            <td height="7" bgcolor="#ADCE4C"><input name="txthoursepower" type="text" class="styleblack" id="txthoursepower" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" maxlength="10"></td>
            <td height="7" bgcolor="#ADCE4C" class="stylegreen"><span class="stylegreen">No. of hook (pcs)</span></td>
            <td height="7" bgcolor="#ADCE4C"><span class="stylewhitesmall">
              <input name="txthook" type="text" class="styleblack" id="txthook" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" maxlength="10" />
            </span></td>
            </tr>
            <tr>
              <td height="6" valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Gross tonnage&nbsp;</td>
              <td height="6" bgcolor="#ADCE4C"><input name="txtgrosston" type="text" class="styleblack" id="txtgrosston" maxlength="10"></td>
              <td height="6" bgcolor="#ADCE4C" class="stylewhitesmall"><span class="stylegreen">hook size (mm) </span></td>
            <td height="6" bgcolor="#ADCE4C" class="stylewhitesmall"><input name="txthooksize2" type="text" class="styleblack" id="txthooksize2" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" size="4" maxlength="4" /></td>
            </tr>
            <tr>
              <td height="3" valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Type of hull&nbsp;</td>
              <td height="3" bgcolor="#ADCE4C"><input name="txthull" type="text" class="styleblack" id="txthull" maxlength="20"></td>
              <td height="3" bgcolor="#ADCE4C" class="stylewhitesmall"><span class="stylegreen">Number of units or sets  </span></td>
              <td height="3" bgcolor="#ADCE4C" class="stylewhitesmall"><input name="txtunit2" type="text" class="styleblack" id="txtunit2" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" size="4" maxlength="4" /></td>
            </tr>
            <tr>
              <td height="4" valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Date Build </td>
              <td height="4" bgcolor="#ADCE4C">
              
              <!-- <input type="checkbox" name="checkbox" id="checkbox" value="1">
                <span class="styleblack">Not set
                <Script language="JavaScript">DateInput('datebuild', true, 'YYYY-MM-DD')</script>
              </span> --> <input name="inputField" type="text" class="styleblack" id="inputField" size="12" /></td>
              <td height="4" bgcolor="#ADCE4C" class="stylegreen">&nbsp; </td>
            <td height="4" bgcolor="#ADCE4C" class="stylewhitesmall">&nbsp;</td>
            </tr>
            <tr>
              <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">
                <div align="left">
                  <div align="left">&nbsp;Place build&nbsp; &nbsp; </div>
                </div>
              </div></td>
              <td height="13" bgcolor="#ADCE4C"> <span class="stylegreen">
           
                <input name="txtplacebuild" type="text" class="styleblack" id="txtplacebuild3" maxlength="10">
              </span></td>
              <td height="13" colspan="2" bgcolor="#6B716F" class="stylegreen"><span class="stylewhitesmall">&nbsp;Owner Description</span></td>
            </tr>
            <tr>
              <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Number of Crew&nbsp; </td>
              <td height="13" valign="top" bgcolor="#ADCE4C"><input name="txtnoofcrew" type="text" class="styleblack" id="txtnoofcrew" onKeyPress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" maxlength="4"></td>
              <td bgcolor="#ADCE4C" class="stylegreen">Name</td>
              <td bgcolor="#ADCE4C"><input name="txtname" type="text" class="styleblack" id="txtname3" maxlength="30"></td>
            </tr>
            <tr>
              <td valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Picture
                <label></label></td>
              <td valign="top" bgcolor="#ADCE4C"><input name="fileField2" type="file" class="styleblack" id="fileField2"></td><td height="7" bgcolor="#ADCE4C" class="stylegreen">Address</td>
              <td height="7" bgcolor="#ADCE4C" class="stylegreen"><span class="styletextbox">
                <input name="txtaddress" type="text" class="styleblack" id="txtaddress3" value="" size="30">
              </span></td>
            </tr>
            <tr class="stylegreen">
              <td valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;Remark</td>
              <td rowspan="3" valign="top" bgcolor="#ADCE4C"><textarea name="textremark" id="textremark" cols="25" rows="4"></textarea></td>
              <td height="7" bgcolor="#ADCE4C"> State/Province</td>
              <td height="7" bgcolor="#ADCE4C"><span class="styletextbox">
                <select name="txtdistrict" class="styleblack" id="select">
                  <?php
				  echo "<option value='$editdistrict'>$editdistrictname</option>";
				  include "connect.inc.php";
		 $sqlgetdis = "select disid,disname from district order by disname";
	  	$qrygetdis = mysql_query($sqlgetdis);
	  	$numgetdis = mysql_num_rows($qrygetdis);
	   for($i=1;$i<=$numgetdis;$i++)
		{
			$resgetdis = mysql_fetch_array($qrygetdis);
			$dbdisid = $resgetdis["disid"];
			$dbdisname = $resgetdis["disname"];
			echo "<option value='$dbdisid'>$dbdisname</option>";
		}
			  ?>
                </select>
              </span></td>
            </tr>
            <tr class="stylegreen">
              <td valign="top" bgcolor="#ADCE4C" class="stylegreen">&nbsp;</td>
              <td height="3" bgcolor="#ADCE4C">Email</td>
              <td height="3" bgcolor="#ADCE4C"><input name="txtemail" type="text" class="styleblack" id="txtemail3" maxlength="30"></td>
            </tr>
            <tr class="stylegreen">
              <td valign="top" bgcolor="#ADCE4C" class="stylegreen"><label></label></td>
              <td height="4" bgcolor="#ADCE4C">Contact number</td>
              <td height="4" bgcolor="#ADCE4C"><input name="txtcontactno" type="text" class="styleblack" id="txtcontactno" maxlength="20"></td>
            </tr>
            <tr class="stylegreen">
              <td height="7" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left"></div></td>
              <td height="7" colspan="3" bgcolor="#ADCE4C">&nbsp;</td>
            </tr>
            <tr>
              <td height="17" colspan="4" bgcolor="#ADCE4C"><div align="center">
                <input name="submit" type="submit" class="styleblack" id="submit" value="Insert" />
                <input name="Reset" type="reset" class="styleblack" id="button" value="Cancel" />
              </div></td>
            </tr>
            <tr>
              <td height="19" colspan="4" bgcolor="#6B716F"><div align="right"></div></td>
            </tr>
          </table>
        </form>
        <?
		}
		elseif(isset($_GET["edtship"]))
		//if(isset($edtport))
		{
		//echo "set edit";
		$edtshipname = base64_decode($_GET["edtship"]);
		$sqlgetdesc = "SELECT ShipId,ShipName,Owner,ShipLength,EngineType,EngineHP,ShipWidth,ShipDepth,GrossTon,TypeofHull,DateBuild,PlaceBuilt,NumberofCrew,OwnerAddress,OwnerContactNumber,email,District,disname,GearType,fishinggear,NetLength,NetWidth,MeshSize,NoHook,PicShip,ship.fishsector,fishingsector.sector,gearlicence,expiredate,hooksize,nounit";
		$sqlgetdesc = $sqlgetdesc." FROM ship left join district on district.disid = ship.District left join gearandmethod on ship.GearType =  gearandmethod.fgid left join fishingsector on ship.fishsector = fishingsector.sid where ShipName = '$edtshipname'";
		//echo $sqlgetdesc;
		$qrygetdesc = mysql_query($sqlgetdesc);
		$resgetdesc = mysql_fetch_array($qrygetdesc);
		$editshipname = $resgetdesc["ShipName"];
		$editshipid = $resgetdesc["ShipId"];
		$editowner = $resgetdesc["Owner"];
		$editshiplength = $resgetdesc["ShipLength"];
		$editenginetype = $resgetdesc["EngineType"];
		$edithp = $resgetdesc["EngineHP"];
		$editshipwidth = $resgetdesc["ShipWidth"];
		$editshipdepth = $resgetdesc["ShipDepth"];
		$editgrosston = $resgetdesc["GrossTon"];
		$edithull = $resgetdesc["TypeofHull"];
		$editdatebuild = $resgetdesc["DateBuild"];
		$editplacebuild = $resgetdesc["PlaceBuilt"];
		$editnatinality = $resgetdesc["Nationality"];
		$editcrew = $resgetdesc["NumberofCrew"];	
		$editaddress = $resgetdesc["OwnerAddress"];
		$editcontact = $resgetdesc["OwnerContactNumber"];
		$editemail = $resgetdesc["email"];
		$editdistrict = $resgetdesc["District"];
		$editdistrictname = $resgetdesc["disname"];
		$editpicship = $resgetdesc["PicShip"];
		$editpicowner = $resgetdesc["PicOwner"];
		
		$editgearid = $resgetdesc["GearType"];
		$editgear = $resgetdesc["fishinggear"];
		//$editzone = $resgetdesc["zoneid"];
		$editnetlength = $resgetdesc["NetLength"];
		$editnetwidth = $resgetdesc["NetWidth"];
		$editmeshsize = $resgetdesc["MeshSize"];
		$editnohook = $resgetdesc["NoHook"];
		$editshipimage = $resgetdesc["PicShip"];
		//`fishsector`, `gearlicence`, `expiredate`, `zoneid`, `hooksize`, `nounit`
		$editfishsector = $resgetdesc["fishsector"];
		$editfishsectorname = $resgetdesc["sector"];
		$editgearlicence = $resgetdesc["gearlicence"];
		$editexpiredate = $resgetdesc["expiredate"];
		$edithooksize = $resgetdesc["hooksize"];
		$editnounit = $resgetdesc["nounit"];
		
		$encodeship = base64_encode($editshipname);
			//?edtship=<? echo $encodeship;"
        ?>
       <br>
        
        <form action="vessel.php?edtship=<? echo $encodeship;?>" method="post" enctype="multipart/form-data" name="form2" id="form2" onSubmit="return onUpdate()">
            <table width="95%" height="195" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="19" colspan="4" background="images/index_01.gif"><div align="center"><span class="stylewhite">Edit Vessel</span><span class="stylewhite"><a href="vessel.php?delship=<? echo $edtship; ?>"><span class="stylegreen"><span class="styleblack">
                  <input type="hidden" name="hdpid2" id="hdpid2" value="<? echo $edtshipname; ?>">
                </span></span></a></span></div>
                <div align="right"></div></td>
              </tr>
              <tr align="center">
                <td height="3" colspan="4" bgcolor="#ADCE4C" class="style1"><?php
				
				$shipImage = $editshipimage;
				$defaultpath = "ship/noimage.jpg";
				$picpath = "ship/".$shipImage;
				if($shipImage =="")
				{
				//echo $defaultpath;
				echo "<img src='$defaultpath' width='500' height='250'/>";
				}
				else
				{
				//echo $picpath;
					if(file_exists($picpath))
					{
					echo "<img src='$picpath' width='500' height='250'/>";
					echo "<input name='delimg' type='submit' class='styleblack' id='delimg' value='delete'>";
					//echo "<a href='vessel.php?delpicship=$encodeship'>"."Delete"."</a>";
					}
					else
					{
					//echo "file not found";
					echo "<img src='$defaultpath' width='500' height='250'/>";
					}
				}
				
				?></td>
              </tr>
              <tr>
                <td width="20%" height="12" valign="top" bgcolor="#ADCE4C" class="style1"><div align="left"><span class="stylegreen">&nbsp;Vessel Name</span>&nbsp; </div></td>
                <td width="30%" height="12" bgcolor="#ADCE4C"><label>
                  <input name="txtvesselname2" type="text" class="styleblack" id="txtvesselname2" value="<? echo $editshipname; ?>" maxlength="20">
                </label></td>
                <td colspan="2" bgcolor="#6B716F" class="stylewhitesmall">&nbsp;Fishing gear description</td>
              </tr>
              <tr>
                <td height="3" valign="top" bgcolor="#ADCE4C" class="style1"><div align="left"><span class="stylegreen">&nbsp;Registration no.</span>&nbsp; </div></td>
                <td height="3" bgcolor="#ADCE4C"><input name="txtregisno2" type="text" class="styleblack" id="txtregisno2" value="<? echo $editshipid; ?>" maxlength="20"></td>
                <td width="20%" height="3" bgcolor="#ADCE4C" class="stylegreen">Type of gear</td>
                <td width="30%" height="3" bgcolor="#ADCE4C"><span class="styletextbox">
                  <select name="txttypeofgear2" class="styleblack" id="txttypeofgear2">
                    <?php
				 
				echo "<option value='$editgearid'>$editgear</option>";
		 $sqlgetgear = "select fgid,fishinggear,fishmethod from gearandmethod where fgid != $editgearid order by fgid";
	  
	  $qrygetgear = mysql_query($sqlgetgear);
	  $numgetgear = mysql_num_rows($qrygetgear);
	   for($i=1;$i<=$numgetgear;$i++)
		{
			$resgetgear = mysql_fetch_array($qrygetgear);
			$dbfgid = $resgetgear["fgid"];
			$dbgear = $resgetgear["fishinggear"];
			$dbmethod = $resgetgear["fishmethod"];
			
				if($dbmethod != "")
				{
					$gear =  $dbgear."(".$dbmethod.")"; 
				}
				else
				{
					$gear = $dbgear;
				}
				echo "<option value='$dbfgid'>$gear</option>";
			  }
			  ?>
                </select>
                </span>                <span class="styletextbox">                </span></td>
              </tr>
              <tr>
                <td height="3" valign="top" bgcolor="#ADCE4C" class="style1"><div align="left"><span class="stylegreen">&nbsp;Type of Fishing Sector</span>&nbsp; </div></td>
                <td height="3" bgcolor="#ADCE4C"><span class="styletextbox">
                  <select name="lstsector2" class="styleblack" id="lstsector2">
                    <?php
					echo "<option value='$editfishsector'>$editfishsectorname</option>";
		 $sqlgetgeart = "SELECT shptid,manpower,sector FROM shiptype inner join fishingsector on fishingsector.sid = shiptype.sid where shptid!=$editfishsector ";
	  	$qrygetgeart = mysql_query($sqlgetgeart);
	  	$numgetgeart = mysql_num_rows($qrygetgeart);
	   for($gt=1;$gt<=$numgetgeart;$gt++)
		{
			$resgetgeart = mysql_fetch_array($qrygetgeart);
			$dbfgtid = $resgetgeart["shptid"];
			$dbmanpower = $resgetgeart["manpower"];
			$dbsector = $resgetgeart["sector"];
			$fsector = $dbsector;
			//$fsector = $dbsector." (".$dbmanpower.")";
			echo "<option value='$dbfgtid'>$fsector</option>";
			  }
			  ?>
                  </select>
                </span></td>
                <td width="20%" height="3" bgcolor="#ADCE4C" class="stylegreen">Fishing gear license no.</td>
                <td width="30%" height="3" bgcolor="#ADCE4C"><input name="txtlicenceno2" type="text" class="styleblack" id="txtlicenceno2" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57)" value="<? echo $editgearlicence; ?>" size="10" maxlength="10" ></td>
              </tr>
              <tr>
                <td height="7" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Length&nbsp; </div></td>
                <td height="7" bgcolor="#ADCE4C" class="styleblack"><input name="txtlength2" type="text" class="styleblack" id="txtlength2" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editshiplength; ?>" maxlength="10"></td>
                <td height="3" bgcolor="#ADCE4C" class="stylegreen">Expiring date</td>
                <td height="3" bgcolor="#ADCE4C">
				
                <span class="styleblack">
                <?
                if($editexpiredate == "" || $editexpiredate == "0000-00-00")
                {
				?>
				 <input name="inputField2" type="text" class="styleblack" id="inputField2" size="12" />
                <?
                }
				else
				{
				?>
                <input name="inputField2" type="text" class="styleblack" id="inputField2" value="<? echo $editexpiredate; ?>" size="12" />
                <?
				}
				?>
                </span>
                </td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Width&nbsp; </div></td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txtwidth2" type="text" class="styleblack" id="txtwidth2" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editshipwidth; ?>" maxlength="10"></td>
                <td height="7" bgcolor="#ADCE4C" class="stylegreen">Net Length</td>
                <td height="7" bgcolor="#ADCE4C" class="styleblack"><span class="styletextbox">
                  <input name="txtnetlength2" type="text" class="styleblack" id="txtnetlength2" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editnetlength; ?>" maxlength="10" />
                </span></td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Depth&nbsp; </div></td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txtdepth2" type="text" class="styleblack" id="txtdepth2" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editshipdepth; ?>" maxlength="10"></td>
                <td height="13" bgcolor="#ADCE4C" class="stylegreen">Net Width</td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txtnetwidth2" type="text" class="styleblack" id="txtnetwidth2" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editnetwidth; ?>" maxlength="10" /></td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Engine type&nbsp; </div></td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack">
                  <select name="txtenginetype2" class="styleblack" id="txtenginetype2">
                  <?
                  if($editenginetype == "Diesel")
                  {
				  ?>
                    <option value="Diesel">Diesel</option>
                    <option value="Petrol">Petrol</option>
                    <option value=""></option>
                  <?
                  }
                  elseif($editenginetype == "Petrol")
                  {
				  ?>
                  <option value="Petrol">Petrol</option>
                   <option value="Diesel">Diesel</option>
                    <option value=""></option>
                   <? 
                  }
				  else
				  {
				  ?>
                  <option value=""></option>
				  <option value="Petrol">Petrol</option>
                  <option value="Diesel">Diesel</option>
				 <?
                  }
                  ?>
                  </select></td>
                <td height="13" bgcolor="#ADCE4C" class="stylegreen">Mesh size</td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txtmeshsize2" type="text" class="styleblack" id="txtmeshsize2" onkeypress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editmeshsize; ?>" maxlength="10" /></td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Horse power&nbsp; </div></td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txthoursepower2" type="text" class="styleblack" id="txthoursepower2" onKeyPress="if (event.keyCode&lt;46||event.keyCode&gt;57) event.returnValue=false" value="<? echo $edithp; ?>" maxlength="10"></td>
                <td height="13" bgcolor="#ADCE4C" class="stylegreen"><span class="stylegreen">No. of hook</span></td>
                <td height="13" bgcolor="#ADCE4C" class="styleblack"><span class="stylewhitesmall">
                  <input name="txthook2" type="text" class="styleblack" id="txthook2" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editnohook; ?>" maxlength="10" />
                </span></td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Gross tonnage&nbsp; </div></td>
    <td height="13" bgcolor="#ADCE4C" class="styleblack"><input name="txtgrosston2" type="text" class="styleblack" id="txtgrosston2" value="<? echo $editgrosston; ?>" maxlength="10"></td>
                <td height="13" bgcolor="#ADCE4C" class="stylewhitesmall"><span class="stylegreen">hook size (mm) </span></td>
                <td height="13" bgcolor="#ADCE4C" class="stylewhitesmall"><span class="styleblack">
                  <input name="txthooksize" type="text" class="styleblack" id="txthooksize3" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" size="4" maxlength="4" />
                </span></td>
              </tr>
              <tr>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Type of hull&nbsp; </div></td>
                <td height="13" valign="top" bgcolor="#ADCE4C" class="styleblack"><input name="txthull2" type="text" class="styleblack" id="txthull2" value="<? echo $edithull; ?>" maxlength="20"></td>
                <td height="3" bgcolor="#ADCE4C" class="stylewhitesmall"><span class="stylegreen">Number of units or sets </span></td>
                <td height="3" bgcolor="#ADCE4C" class="stylewhitesmall"><input name="txtunit" type="text" class="styleblack" id="txtunit3" onkeypress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" size="4" maxlength="4" /></td>
              </tr>
              <tr>
                <td height="6" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Date Build&nbsp; </div></td>
                <td height="6" valign="top" bgcolor="#ADCE4C">
                
                <?
                if($editdatebuild == "" || $editdatebuild == "0000-00-00")
                {
				?>
				 <input name="inputField" type="text" class="styleblack" id="inputField" size="12" />
                <?
                }
				else
				{
				?>
                <input name="inputField" type="text" class="styleblack" id="inputField" value= "<? echo $editdatebuild; ?>" size="12" />
               	<?
			   	}
			   	?>
                
               </td>
                <td height="4" bgcolor="#ADCE4C" class="stylegreen">&nbsp; </td>
                <td height="4" bgcolor="#ADCE4C" class="stylewhitesmall">&nbsp;</td>
              </tr>
              <tr class="stylegreen">
                <td height="7" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Place build&nbsp; </div></td>
                <td height="7" bgcolor="#ADCE4C"><input name="txtplacebuild2" type="text" class="styleblack" id="txtplacebuild2" value="<? echo $editplacebuild; ?>" maxlength="20"></td>
                <td height="6" colspan="2" bgcolor="#6B716F"><span class="stylewhitesmall">Owner Description</span></td>
              </tr>
              <tr class="stylegreen">
                <td height="6" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Nationality&nbsp; </div></td>
                <td height="6" bgcolor="#ADCE4C" class="styleblack"><input name="txtnationality2" type="text" class="styleblack" id="txtnationality2" value="<? echo $editnatinality; ?>" maxlength="20"></td>
                <td bgcolor="#ADCE4C">Name</td>
                <td bgcolor="#ADCE4C" class="styleblack"><input name="txtname2" type="text" class="styleblack" id="txtname22" value="<? echo $editowner; ?>" size="30" maxlength="30"></td>
              </tr>
              <tr class="stylegreen">
                <td height="3" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Number of Crew&nbsp; </div></td>
                <td height="3" bgcolor="#ADCE4C" class="styleblack"><input name="txtnoofcrew2" type="text" class="styleblack" id="txtnoofcrew2" onKeyPress="if (event.keyCode&lt;48||event.keyCode&gt;57) event.returnValue=false" value="<? echo $editcrew; ?>" maxlength="4"></td>
                <td height="7" bgcolor="#ADCE4C">Address</td>
                <td height="7" bgcolor="#ADCE4C" class="styleblack"><span class="stylegreen"><span class="styletextbox">
                  <input name="txtaddress2" type="text" class="styleblack" id="txtaddress22" value="<? echo $editaddress; ?>" size="30" maxlength="30">
                </span></span></td>
              </tr>
              <tr class="stylegreen">
                <td height="2" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Picture</div></td>
                <td height="2" bgcolor="#ADCE4C" class="styleblack"><input name="fileField" type="file" class="styleblack" id="fileField"></td>
                <td bgcolor="#ADCE4C">State/Province</td>
                <td bgcolor="#ADCE4C" class="styleblack"><span class="styletextbox">
                  <select name="txtdistrict2" class="styleblack" id="select3">
                    <?php
				  include "connect.inc.php";
				  if($editdistrict != "" && $editdistrict != "0" )
				  {
				  echo "<option value='$editdistrict'>$editdistrictname</option>";
				  echo "<option value=''></option>";
				  }
				  else
				  {
				  echo "<option value=''></option>";
				  }
		 $sqlgetdis = "select disid,disname from district order by disname";
	  	$qrygetdis = mysql_query($sqlgetdis);
	  	$numgetdis = mysql_num_rows($qrygetdis);
	   for($i=1;$i<=$numgetdis;$i++)
		{
			$resgetdis = mysql_fetch_array($qrygetdis);
			$dbdisid = $resgetdis["disid"];
			$dbdisname = $resgetdis["disname"];
			echo "<option value='$dbdisid'>$dbdisname</option>";
		}
			  ?>
                  </select>
                </span></td>
              </tr>
              <tr class="stylegreen">
                <td height="2" rowspan="3" valign="top" bgcolor="#ADCE4C" class="stylegreen"><div align="left">&nbsp;Remark&nbsp; </div></td>
                <td height="2" rowspan="3" bgcolor="#ADCE4C" class="styleblack"><textarea name="textremark2" id="textremark2" cols="25" rows="4"></textarea></td>
                <td bgcolor="#ADCE4C">Email</td>
                <td bgcolor="#ADCE4C" class="styleblack"><input name="txtemail2" type="text" class="styleblack" id="txtemail22" value="<? echo $editemail; ?>" maxlength="30"></td>
              </tr>
              <tr class="stylegreen">
                <td bgcolor="#ADCE4C">Contact number</td>
                <td bgcolor="#ADCE4C"><span class="styleblack">
                  <input name="txtcontactno2" type="text" class="styleblack" id="txtcontactno22" value="<? echo $editcontact; ?>" maxlength="20">
                </span></td>
              </tr>
              <tr class="stylegreen">
                <td height="2" bgcolor="#ADCE4C">&nbsp;</td>
                <td height="2" bgcolor="#ADCE4C">&nbsp;</td>
              </tr>
              <tr>
                <td height="17" colspan="4" bgcolor="#ADCE4C"><div align="center">
                    <input name="submit2" type="submit" class="styleblack" id="submit2" value="Update" />
					<input name="button2" type="button" class="styleblack" id="button2" value="Cancel" onClick="window.location='vessel.php';">
                </div></td>
              </tr>
              <tr>
                <td height="19" colspan="4" bgcolor="#6B716F"><div align="right"></div></td>
              </tr>
            </table>
        </form>
        <?
		}
		if(isset($_GET["delship"]))
		{
		$delshipname = base64_decode($_GET["delship"]);
		?>
       <br>
        <form action="vessel.php" method="post" name="form3" id="form3">
          <table width="82%" height="86" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="100%" height="19" background="images/index_01.gif"><div align="center"><span class="stylewhite">Delete Vessel</span></div>
                  <div align="right"></div></td>
            </tr>
            <tr>
              <td height="25" bgcolor="#ADCE4C" class="style1"><label>
                  <br>
                <div align="center" class="stylewhite"><span class="styleblack">
                  <input type="hidden" name="hdpid3" id="hdpid3" value="<? echo $delshipname; ?>">
                </span>&nbsp; Are you sure to delete <br>
                 Sampling Vessel '<span class="styleblacklargered"><? echo $delshipname; ?></span>'?</div></td>
            </tr>
            <tr>
              <td height="34" bgcolor="#ADCE4C"><label>                <div align="center">
                    <input name="submit3" type="submit" class="styleblack" id="submit3" value="Confirm" />
                  <input name="button22" type="button" class="styleblack" id="button22" value="Cancel" onclick="window.location='vessel.php';" />
                  </div>
                </label></td>
            </tr>
            <tr>
              <td height="19" bgcolor="#6B716F"><div align="right"></div></td>
            </tr>
          </table>
        </form>
        <?
        }
		?></td>
  </tr>
	<tr>
	  <td colspan="2" bgcolor="#006666"><div align="right"><span class="styleblack">@SEAFDEC 2012</span></div></td>
  </tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>