<?php
include("CheckSession.php");
?>
<!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" />
<meta name="description" content="馬戲團" />
<title>馬戲團</title>
<Script Language="javascript" src="control/calendar.js"></Script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<?php
require_once("class/DBConfig.php");
require_once("class/DBOperation.php");

date_default_timezone_set('Asia/Taipei');
$strNowDate = Date('Y-m-d');

$actionOp = $_GET["actionOp"];
$CCId = $_GET["CCId"];
$CNickname = $_GET["CNickname"];

$db = new DBOperation();

if($actionOp == "Update")
{  
  $id = $_GET["id"];
  $db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
  $db->query("SELECT * FROM CMissContent where CId = '".$db->mysql_real_escape_string($id)."'");
  $row = $db->fetch_row();
  $CMiss = $row[2];
  $CMissDate = $row[3];
  $db->close_db();
}

?>
<SCRIPT language="JavaScript">
function validateForm(objThisUi) 
{
	if(objThisUi.CMiss.value.length == 0)
	{
		alert("請輸入消費內容!!");
		objThisUi.CMiss.focus();		
		return false;                              
	}
	
	return true;  
}
</SCRIPT>
<body>
<form name="CustomerForm" method="post" action="CMissContentUpdateDeal.php" id="CustomerForm"
 onSubmit="return validateForm(this);">
<input type="hidden" name="actionOp" id="actionOp" value="<?php echo $actionOp ?>"/>
<input type="hidden" name="id" id="id" value="<?php echo $id ?>"/>
<input type="hidden" name="CCId" id="CCId" value="<?php echo $CCId ?>"/>
<input type="hidden" name="CNickname" id="CNickname" value="<?php echo $CNickname ?>"/>
<table border="0" cellspacing="0" cellspadding="0" width="100%">
<tr>
<td align="left" colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td align="left" colspan="2">
<span class="t14b"><b>新增/修改<?php echo $CNickname ?>的消費內容</b></span>
</td>
</tr>
<tr>
<td align="left" colspan="2">

<table border="3" cellspacing="2" cellspadding="2" width="100%">
<tr>
<td align="left" width="20%">
<span class="t12">消費內容</span>
</td>
<td align="left" width="80%">
<input type="text" value="<?php echo $CMiss ?>" name="CMiss" id="CMiss" size="60" maxlength="70" style="font-size: 12.0pt;font-family: 微軟正黑體;"/>
</td>
</tr>
<tr>
<td align="left" width="20%">
<span class="t12">消費日期</span>
</td>
<td align="left">
<input type="text" value="<?php if($CMissDate != null) echo $CMissDate; else echo $strNowDate;?>" name="CMissDate" id="CMissDate" readonly="readonly" class="t12">
<img align="top" onmousedown="Cal(CustomerForm.CMissDate,1,100,50,999,0,'')" src="images/cal.gif" width="16" height="16" style="cursor:hand">
</td>
</tr>
<tr>
<td  align="center" colspan="2">
<input type="submit" name="btnSub" id="btnSub" value="<?php if($actionOp == "Insert") echo "確認新增"; else echo "確認修改" ?>" class="t12" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
