<style>
  .pwbtn{
    width:50px;
	cursor:pointer;
	margin-left:15px;
  }
  .tblfont{
    font-size:40px;
  }
	
  .tblpage{
    width: 100%;
	height: 100%;
  }
  .tblborder{
    border-style:double;
	width: 250px;
  }
  .tbltable{
    width:100%;
	font-family:Arial;
	text-align:center;
  }
  .ipttext{
    text-align:center;
  }
  .errmsg{
    color:#FF0000; 
	font-size:18px;
  }

	.spaninput{
		margin: 0px 0px 10px 10px;
	}
	
	.btnSubmit{
		width: 100px;
		height: 30px;
		font-size: 20px;
	}
</style>

<script>
  var loadImage = function(event){
	  var myphoto = document.getElementById('myphoto');
	  myphoto.src = URL.createObjectURL(event.target.files[0]);
	  myphoto.onload = function(){
		  URL.revokeObjecjtURL(myphoto.src)
	  }
  };
</script>

<?php
  $pid = $_GET["id"];
  $myprod = new PRODUCT();
  $myprod->setProduct("id",$pid);
//  print_r($myprod);
?>
<table class="tblpage" border="1"><tr><td align="center">

	<form action="pg_product_up.php" enctype="multipart/form-data" method="post">
	<input type="hidden" name="pid" value="<?= $myprod->id ?>" />
	<table class="tblborder"><tr><td align="center">
	<table class="tbltable">
	  <tr>
	    <th colspan="2" style="background-color:#000000; color:#FFFFFF"><?= $myprod->name . " " . $myprod->ename ?></th>
	  </tr>
	  <tr>
	    <td><img id="myphoto" src="../img/<?= $myprod->photo ?>" height="200px">
		<input type="file" id="myphoto" name="myphoto" width="50px" onChange="loadImage(event)" ></td>
		  
		  
		<td>
			<table width="100%">
				<tr>
					<td>NAME : </td>
				</tr>
				<tr>
					<td><span class="spaninput"><input type="text" name="ename" value="<?= $myprod->ename ?>"></span></td>
				</tr>
				<tr>
					<td>名称 : </td>
				</tr>
				<tr>
					<td><span class="spaninput"><input type="text" name="cname" value="<?= $myprod->name ?>"></span></td>
				</tr>
				<tr>
					<td>PRICE 卖价 : </td>
				</tr>
				<tr>
					<td><span class="spaninput"><input type="text" name="price" value="<?= $myprod->price ?>"></span></td>
				</tr>
				<tr>
					<td>STOCK 存货 : </td>
				</tr>
				<tr>
					<td><span class="spaninput"><input type="text" name="stock" value="<?= $myprod->stock ?>"></span></td>
				</tr>

			</table>
			
		</td>
	  </tr>
	  <tr>
	    <th colspan="2" style="background-color:#000000; color:#FFFFFF">
		<input name="submit" class="btnSubmit" type="submit" value="SAVE">
		<?php
		  if($myprod->pstatus==1){
		?>
		<input name="submit" class="btnSubmit" style="background-color:#FF0000; color:#FFFFFF" type="submit" value="PASSIVE">
		<?php
		  }else{
		  ?>
		<input name="submit" class="btnSubmit" style="background-color:#0000FF; color:#FFFFFF" type="submit" value="ACTIVE">
		<input name="submit" class="btnSubmit" style="background-color:#FF0000; color:#FFFFFF" type="submit" value="DELETE">
		<?php
		  }
		?>
		</th>
	  </tr>
		
	</table>
	</td></tr></table>
	</form>

</td></tr></table>